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

Help me on this local script?

I made a local script and put it in the statergui, the local script is suppost to test if the player is sitting and if it does it kills them.

Sit = game.Players.Character.Humanoid.Sit
Humanoid = game.Players.Character.Humanoid


if Sit == true then
	Humanoid.Health = 0
end

1 comment

0

updated

1 answer

✓ Accepted answer

Well, to access the LocalPlayer, you need to add that to the path. Also, your script doesn't constantly check, so therefore you would need a loop.

while wait() do
    repeat wait() until game.Players.LocalPlayer.Character -- Lets it load
	Sit = game.Players.LocalPlayer.Character.Humanoid.Sit
	Humanoid = game.Players.LocalPlayer.Character.Humanoid
    if Sit == true then
        Humanoid.Health = 0
    end
end

4 comments

0

It Did Not Work :/

0

My apologies, updated it.

0

The repeat loop should be before the while loop. Why not have Humanoid be defined first, then have Sit be Humanoid.Sit?

0

Well, the repeat loop could be before or after. It wouldn't make a difference. The reason I didn't do those variable changes was because he had them that way, and I wanted to keep his style. It wouldn't make a difference.

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