generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: From Killing, to Respawning.

Previous Thread :: Next Thread 
manofthesnakes is not online. manofthesnakes
Joined: 17 Aug 2010
Total Posts: 94
29 Jun 2014 01:01 PM
How would you change this script, so that when you click that button, it respawns you, instead of killing you?

function onButtonClicked()
script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
end

script.Parent.MouseButton1Click:connect(onButtonClicked)
Report Abuse
RoflBread is not online. RoflBread
Joined: 18 Jun 2009
Total Posts: 3803
29 Jun 2014 01:13 PM
player:LoadCharacter()
Report Abuse
manofthesnakes is not online. manofthesnakes
Joined: 17 Aug 2010
Total Posts: 94
29 Jun 2014 01:47 PM
So it would be this?

function onButtonClicked()
player:LoadCharacter()

script.Parent.MouseButton1Click:connect(onButtonClicked)
Report Abuse
insaneROBLOXER123 is not online. insaneROBLOXER123
Joined: 23 Nov 2011
Total Posts: 192
29 Jun 2014 01:48 PM
No, this.

script.Parent.MouseButton1Click:connect(function(char) game.Players:GetPlayerFromCharacter(char):LoadCharacter() end)

Try that.

-IПƧΛПΣ-
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
29 Jun 2014 01:51 PM
Uhh no.
Shouldn't it be this?


script.Parent.MouseButton1Click:connect(function(Player)
Player:LoadCharacter()
end)
Report Abuse
manofthesnakes is not online. manofthesnakes
Joined: 17 Aug 2010
Total Posts: 94
29 Jun 2014 01:53 PM
@insane, I tried yours, it didn't work. I'm going to try the other one.
Report Abuse
manofthesnakes is not online. manofthesnakes
Joined: 17 Aug 2010
Total Posts: 94
29 Jun 2014 01:56 PM
They both didn't work.
Report Abuse
insaneROBLOXER123 is not online. insaneROBLOXER123
Joined: 23 Nov 2011
Total Posts: 192
29 Jun 2014 01:56 PM
I just remembered that this isnt a brick, and a gui... nvm on mine.

-IПƧΛПΣ-
Report Abuse
manofthesnakes is not online. manofthesnakes
Joined: 17 Aug 2010
Total Posts: 94
29 Jun 2014 01:59 PM
Anyone have any other suggestions?
Report Abuse
RoflBread is not online. RoflBread
Joined: 18 Jun 2009
Total Posts: 3803
29 Jun 2014 01:59 PM
script.parent.parent.parent etc until you get to the player, then use the method
Report Abuse
manofthesnakes is not online. manofthesnakes
Joined: 17 Aug 2010
Total Posts: 94
29 Jun 2014 02:01 PM
What method?
Report Abuse
RoflBread is not online. RoflBread
Joined: 18 Jun 2009
Total Posts: 3803
29 Jun 2014 02:01 PM
:LoadCharacter()
Report Abuse
manofthesnakes is not online. manofthesnakes
Joined: 17 Aug 2010
Total Posts: 94
29 Jun 2014 02:04 PM
So this would be the revised script?

function onButtonClicked()
script.Parent.Parent.Parent.Parent.Parent.Character:LoadCharacter()
end

script.Parent.MouseButton1Click:connect(onButtonClicked)
Report Abuse
Ristone3 is not online. Ristone3
Joined: 17 Aug 2008
Total Posts: 693
29 Jun 2014 02:04 PM
Make it a LocalScript, then you can put this under inside the button.

script.Parent.MouseButton1Click:connect(function()
game.Players.LocalPlayer:LoadCharacter()
end)
Report Abuse
JOJObuddy011 is not online. JOJObuddy011
Joined: 27 Sep 2012
Total Posts: 840
29 Jun 2014 02:08 PM
function onButtonClicked()
script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
wait()
script.Parent.Parent.Parent.Parent.Parent:LoadCharacter()
end

script.Parent.MouseButton1Click:connect(onButtonClicked)
Report Abuse
calebpwns1002 is not online. calebpwns1002
Joined: 29 Mar 2013
Total Posts: 521
29 Jun 2014 02:09 PM
or. use localplayer
Report Abuse
manofthesnakes is not online. manofthesnakes
Joined: 17 Aug 2010
Total Posts: 94
29 Jun 2014 02:13 PM
@Ristone3

I tried yours, didn't work.

@JOJObuddy011

Should I make that a Local Script, or just a Script?
Report Abuse
JOJObuddy011 is not online. JOJObuddy011
Joined: 27 Sep 2012
Total Posts: 840
29 Jun 2014 02:13 PM
Normal script should work.
Report Abuse
manofthesnakes is not online. manofthesnakes
Joined: 17 Aug 2010
Total Posts: 94
29 Jun 2014 02:15 PM
Alright, I will try that and put it in the button. Lets hope it works.
Report Abuse
manofthesnakes is not online. manofthesnakes
Joined: 17 Aug 2010
Total Posts: 94
29 Jun 2014 02:18 PM
It worked, but is there a way so that you don't die first, so you don't get a WO?
Report Abuse
JOJObuddy011 is not online. JOJObuddy011
Joined: 27 Sep 2012
Total Posts: 840
29 Jun 2014 02:19 PM
Nope. I think you would get a KO from respawning anyways.
Report Abuse
JOJObuddy011 is not online. JOJObuddy011
Joined: 27 Sep 2012
Total Posts: 840
29 Jun 2014 02:20 PM
WO*
Report Abuse
JOJObuddy011 is not online. JOJObuddy011
Joined: 27 Sep 2012
Total Posts: 840
29 Jun 2014 02:22 PM
nevermind, hold on, ill find a way.
Report Abuse
JOJObuddy011 is not online. JOJObuddy011
Joined: 27 Sep 2012
Total Posts: 840
29 Jun 2014 02:24 PM
try this





function onButtonClicked()
for i, v in pairs(script.Parent.Parent.Parent.Parent.Parent) do
if v and v.Character then v:LoadCharacter() end
end
end

script.Parent.MouseButton1Click:connect(onButtonClicked)
Report Abuse
klkljr is not online. klkljr
Joined: 14 Mar 2011
Total Posts: 9823
29 Jun 2014 02:25 PM
function scrubs()
game.Players.LocalPlayer:Respawn()
end
script.Parent.MouseButton1Click:connect(scrubs)

~egmen
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image