Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Not killing player that clicks Gui?

I know how to get the parents but its not killing a player when they click on that ImageButton

function Clicked(hit)

    local hum = hit.Parent:FindFirstChild("Humanoid")

    if hum then
        hum.Health = 0
    end
end

script.Parent.MouseButton1Down:connect(Clicked)

1 answer

✓ Accepted answer

There isn't a hit for a gui! This needs to be a local script

script.Parent.MouseButton1Down:connect(function() --easier to define it here
	local hum = game.Players.LocalPlayer.Character:FindFirstChild("Humanoid")
	 if hum then --if humanoid is there then
		hum.Health = 0
	end
end)


This discussion is preserved as it was. New answers, comments, and votes are closed.