How do I make it so a player can't move?

Hello! I want to make my own pre banned players system, But I do not know how to make the player not move. Here is my script. (basically I Don’t want them to be able to move.)

local BannedGui = script.BannedGui
local BannedText = "You have been banned from this game."
game.Players.PlayerAdded:Connect(function(player)
	if player.Name == "Censored for privacy reasons." then
		Lighting.Blur.Size = 50
		BannedGui.Parent = game.StarterGui
		script.BannedGui.Frame.Reason.Text = BannedText
		wait(5)
		player:Kick("You have been banned from this server.")
	end
end)
2 Likes

Just change their WalkSpeed
Otherwise remove their character
Otherwise BindAction with context action service the WASD keys and they shouldn’t move

2 Likes

How do I local BindAction the player’s W, A, S, D keys?

player:BindAction(????)

is it something like that?

Just check context action service https://developer.roblox.com/en-us/api-reference/function/ContextActionService/BindAction

1 Like

This should work, it’s a way to completely disable the players controls:

local controls = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule")):GetControls()
controls:Disable()
5 Likes

Something like this?

local BannedGui = script.BannedGui
local BannedText = "You have been banned from this game."
local ContextActionService = game:GetService("ContextActionService")
game.Players.PlayerAdded:Connect(function(player)
	if player.Name == "###########" then
		Lighting.Blur.Size = 50
		BannedGui.Parent = game.StarterGui
		script.BannedGui.Frame.Reason.Text = BannedText
		wait(5)
		player:Kick("You have been banned from this server.")
		ContextActionService:BindAction(Enum.KeyCode.W, Enum.KeyCode.A, Enum.KeyCode.S, Enum.KeyCode.D)
	end
end)
1 Like

Noonon, Use as Chaasey stated, This wouldn’t work. Check out @Chaasey Method :slight_smile:

1 Like

Alright. {{{((([[[[[30 CHAR]]]]])))}}}

I changed the selected name to TrackoTheTaco so I can test it and it did not work.

local controls = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule")):GetControls()
local BannedGui = script.BannedGui
local BannedText = "You have been banned from this game."
game.Players.PlayerAdded:Connect(function(player)
	if player.Name == "##############" then
		Lighting.Blur.Size = 50
		BannedGui.Parent = game.StarterGui
		script.BannedGui.Frame.Reason.Text = BannedText
		controls:Disable()
		wait(5)
		player:Kick("You have been banned from this server.")
	end
end)

Strange, maybe try setting the players walkspeed to 0, making them unable to move.

game.Players.LocalPlayer.Character.Humanoid.Walkspeed = 0
3 Likes

Try anchoring the humanoidrootpart

game.Players.PlayerAdded:Connect(function(player)
	if player.Name == "Censored for privacy reasons." then 
              player.CharacterAdded:Connect(function(char)
                 char:WaitForChild("HumanoidRootPart").Anchored = true
              end)
	end
end)

Note that the character might stay in the air which you can fix by adding a wait before anchoring the HumanoidRootPart.

3 Likes


Alternatives:

  • WalkSpeed & JumpPower set to 0
  • Anchor character (stops animations)
2 Likes

Thank you! It worked. [[[{{{30 Characters}}}]]]