basically as the title explains, When a player stops moving for more than a second they die, is there anyway to make that?
COMMUNITY QUESTION
How do you make it so when the player stops moving they die?
3 answers
Here
if Humanoid.MoveToDirection.Magnitude == 0 then
--kill
end
Insert in a local script and place in the player.
local player = game.Players.LocalPlayer
while wait(1) do
if player.Character.HumanoidRootPart.Velocity.Magnitude < 1 then
wait(1)
if player.Character.HumanoidRootPart.Velocity.Magnitude < 1 then
player.Character.Humanoid.Health = 0
end
end
end
You can use the Running event in the humanoid.
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
humanoid.Running:connect(function(speed)
if speed > 0 then
print("player is walking")
else
character:BreakJoints() --same thing as Humanoid.Health = 0
end
end)
end)
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
