|
| 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
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
| |
|
|
| 29 Jun 2014 01:47 PM |
So it would be this?
function onButtonClicked() player:LoadCharacter()
script.Parent.MouseButton1Click:connect(onButtonClicked)
|
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 29 Jun 2014 01:51 PM |
Uhh no. Shouldn't it be this?
script.Parent.MouseButton1Click:connect(function(Player) Player:LoadCharacter() end)
|
|
|
| Report Abuse |
|
|
|
| 29 Jun 2014 01:53 PM |
| @insane, I tried yours, it didn't work. I'm going to try the other one. |
|
|
| Report Abuse |
|
|
| |
|
|
| 29 Jun 2014 01:56 PM |
I just remembered that this isnt a brick, and a gui... nvm on mine.
-IПƧΛПΣ- |
|
|
| Report Abuse |
|
|
|
| 29 Jun 2014 01:59 PM |
| Anyone have any other suggestions? |
|
|
| Report Abuse |
|
|
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 |
|
|
| |
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
| |
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
| |
|
|
| 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 |
|
|
|
| 29 Jun 2014 02:13 PM |
| Normal script should work. |
|
|
| Report Abuse |
|
|
|
| 29 Jun 2014 02:15 PM |
| Alright, I will try that and put it in the button. Lets hope it works. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 29 Jun 2014 02:19 PM |
| Nope. I think you would get a KO from respawning anyways. |
|
|
| Report Abuse |
|
|
| |
|
|
| 29 Jun 2014 02:22 PM |
| nevermind, hold on, ill find a way. |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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 |
|
|