makerror
|
  |
| Joined: 29 Aug 2011 |
| Total Posts: 493 |
|
|
| 03 Jul 2013 04:30 AM |
script.Parent.MouseButton1Click:connect(function() button = script.Parent frame = button.Parent gui = button.Parent playergui = gui.Parent player = playergui.Parent char = game.Workspace:FindFirstChild(player.Name) if char ~= nil then h = char:FindFirstChild("Humanoid") h.Health = 0 end end)
I made a text button in Gui's frame and a localscript in button. Tried to add reset function, but everytime I click nothing happens, no errors too, what wrong I did? Everything is in starterGui
Can MouseButton1Click return player object, if I use argument? |
|
|
| Report Abuse |
|
|
|
| 03 Jul 2013 08:02 AM |
You want a reset gui? If it is then
function onButtonClicked() script.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0 end
script.Parent.MouseButton1Click:connect(onButtonClicked)
Try for the reset gui. (If you want one.) |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 03 Jul 2013 08:04 AM |
Simplest:
script.Parent.MouseButton1Down:connect(function() if script.Parent.Parent.Parent.Parent then script.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0 end end) |
|
|
| Report Abuse |
|
|
|
| 03 Jul 2013 08:06 AM |
==gui = frame.Parent== NOT ==gui = button.Parent== |
|
|
| Report Abuse |
|
|
|
| 03 Jul 2013 08:34 AM |
function onButtonClicked() script.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0 end
script.Parent.MouseButton1Down:connect(onButtonClicked) |
|
|
| Report Abuse |
|
|