Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help me on this local script?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

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
0
updated Shawnyg 4330 — 10y

1 answer

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

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

0
It Did Not Work :/ Anthony9960 210 — 10y
0
My apologies, updated it. Shawnyg 4330 — 10y
0
The repeat loop should be before the while loop. Why not have Humanoid be defined first, then have Sit be Humanoid.Sit? Tkdriverx 514 — 10y
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. Shawnyg 4330 — 10y
Ad

Answer this question