iddash
|
  |
| Joined: 19 Jul 2014 |
| Total Posts: 1 |
|
|
| 11 Apr 2017 09:00 AM |
Ok so i want the player who clicked the gui to die Here is the code(it is in a local script): script.Parent.MouseButton1Click:connect(function() local player = game.Players.LocalPlayer local humanoid = game.Workspace.player:FindFirstChild(player) if humanoid then local chec = humanoid:findFirstchild("Humanoid") if chec then chec.Health = 0 end end end)
In the output, it says "player is not a valid member of Workspace" what is wrong?
|
|
|
| Report Abuse |
|
|
|
| 11 Apr 2017 09:03 AM |
script.Parent.MouseButton1Click:connect(function() if Humanoid then local chec = Humanoid:FindFirstChild("Humanoid") if chec then chec.Health = 0 end end end)
local player = game.Players.LocalPlayer local humanoid = game.Workspace.player:FindFirstChild(player)
try this |
|
|
| Report Abuse |
|
|
| |
|
|
| 11 Apr 2017 09:09 AM |
There is no need to overcomplicate it like that all of you are wrong lol.
script.Parent.MouseButton1Click:connect(function() local Player = game.Players.LocalPlayer local Humanoid = Player.Character.Humanoid
Humanoid.Health = nil
end)
#code print(string.rep("Lit",5)) |
|
|
| Report Abuse |
|
|
|
| 11 Apr 2017 09:09 AM |
Also why would you need to check if its a humanoid clicking lol i dont see how a part is going to click it do you?.
#code print(string.rep("Lit",5)) |
|
|
| Report Abuse |
|
|
| |
|