I am making a minigame. In one level the player must stay still. What is an easy way to detect when a player walks and detect what player walked. Can you link a wiki page?
The easiest way to do this is with the Running event of the humanoid.
It'll look something like this:
local MovingCharacter = function(speed) if speed > 2 then --This makes it so they're not just moving from something else or by accident. --Code end end workspace:FindFirstChild(--[[Name of the player]]--).Humanoid.Running:Connect(MovingCharacter)
What the code is doing is it detects if the characters running. Then to check if the character is just being moved or if it's moving at full speed. Just a tiny threshold.
Tomstah is correct, but I just felt that there was a more efficient way of doing it when checking players.
local MovingCharacter = function(speed) if speed > 2 then --This makes it so they're not just moving from something else or by accident. --Code end end for _, player in pairs (game.Players:GetPlayers()) do workspace:FindFirstChild(player).Humanoid.Running:Connect(MovingCharacter) end