I need a character that spawns to not be able to move at all. How can I change this script to either work or be more efficient?
Thank you!!
There are multiple steps you can take! The easiest way would to immediately anchor the players character upon spawning:
game.Players.PlayerAdded:connect(function(p) p.CharacterAdded:connect(function(c) for _,v in pairs(c:GetChildren()) do if v:IsA("BasePart") then v.Anchored = true end end end) end)
If you want to take a more complex way, you can try using the ControllerService; Here's the wiki link to it:
http://wiki.roblox.com/index.php?title=Controlling_a_Player%27s_Character
Or even a more simple way:
game.Players.PlayerAdded:connect(function(p) p.CharacterAdded:connect(function(c) local human = c.Humanoid or c:WaitForChild("Humanoid") human.WalkSpeed = 0 end) end)