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

What Is Wrong? Works Perfectly In Studio.

Asked by
Vezious 310 Moderation Voter
9 years ago

Why Does This Work only in studio? And On Servers It Kills them?

script.Parent.Humanoid.Changed:connect(function()
wait(.00001)
if script.Parent.Humanoid.MoveDirection == Vector3.new(0,0,0) and game.ServerScriptService.Brain.GameStarted.Value == true then
script.Parent.Humanoid.Health = 0
end
end)

game.ServerScriptService.Brain.Announcer.Changed:connect(function()
if game.ServerScriptService.Brain.Announcer.Value == "Players Who Are Not Moving In 0 Seconds Will Die" and script.Parent.Humanoid.MoveDirection == Vector3.new(0,0,0)then
script.Parent.Humanoid.Health = 0
end
end)

Unless You Know Any Other Method To Find Out If A Player Has Stopped moving Im stuck with this method

0
Nope. Vezious 310 — 9y

3 answers

Log in to vote
0
Answered by 9 years ago

Add a wait (1)

0
Nope, Doesn't fixed the problem. Still die. Vezious 310 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

If it's running in studio just fine and not working in your game. It might be executing the script before the game has fully loaded. Try adding a wait function before you run your script. Something like 10 seconds, and then see if that's the issue.

Log in to vote
0
Answered by 9 years ago

The server will not receive Humanoid.MoveDirection information - it only changes for the client (even if FilteringEnabled is false). Just use the character's torso's velocity (assuming it exists - be sure to check for that)

Answer this question