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

What Is Wrong? Works Perfectly In Studio.

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

1 comment

0

Nope.

3 answers

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.

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)

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