How to make a player not move when they spawn inside of my game

so i am a new developer and i found no way to do this if anyone could inform me how to do this that would be great!

1 Like

You can try:

game.Players.PlayerAdded:Connect(function(Plr)
  wait(2)
  game.Workspace[Plr.Name].HumanoidRootPart.Anchored = true
end)
1 Like

Better yet:

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		local HRP = Character:WaitForChild("HumanoidRootPart")
		
		HRP.Anchored = true
	end)
end)

The PlayerAdded & CharacterAdded events are what you need, since those detects whenever a Player Instance (game.Players.Realgoodguyalways) first joins the game, & when a Character Model gets added (workspace.Realgoodguyalways) :wink:

1 Like

ok but… where do you put this script? i tried it inside of workspace but it did not work

You’ll always want to handle these type of scripts inside ServerScriptService as a regular Script, as those will be on the secure side to prevent exploiters from seeing it at all

1 Like

ok thank you so much!!! this works!!!

what if the player unachored them self on the client game.Players.LocalPlayer.Character.HumanoidRootPart.Anchored = false

It’s just preference to keep scripts inside of ServerScriptService as then you would know where all your scripts are.

FilteringEnabled doesn’t allow clients to get the data of Server Scripts anyway. So you’re safe to keep your scripts anywhere you prefer.

I’m fully aware, just that it should be important to reference it since the OP says he is a “new developer” & he should know about it ahead of time :slightly_smiling_face: