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

How Do I Make A Script So The Player Cant Move At A Certain Time?

Because of the TDM Bug

2 answers

You could try setting the player's walkspeed to 0 and then changing it back to 16 when you want them to move again.

Simple anchor their Torso and/or set their walkspeed to 0. To allow movement once again, unanchor their torso and reset their walkspeed to 16, or their last walkspeed. Here's a simple script that enables and disables movement, and restores previous walkspeeds of players.

oldWalkspeeds = {}

function getWalkspeed(name)
    for key, value in pairs(oldWalkspeeds) do
        entry = oldWalkspeeds[key]
		if(entry[1] == name) then
			return entry[2]
		end
    end
    return 16
end

function enableMovement()
    for _, player in pairs(game.Players:GetChildren()) do
        char = player.Character
        char.Torso.Anchored = false
        char.Humanoid.WalkSpeed = getWalkspeed(player.Name)
    end
    oldWalkspeeds = {}
end

function disableMovement()
    oldWalkspeeds = {}
    for _, player in pairs(game.Players:GetChildren()) do
        char = player.Character
        char.Torso.Anchored = true
        walkspeed = char.Humanoid.WalkSpeed
        entry = {player.Name, walkspeed}
        walkspeed = 0
        table.insert(oldWalkspeeds, entry)
    end
end

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