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 lock the Character and camera so that it will stop moving?

players = game.Players
player = game.Players.LocalPlayer
character = player.Character
hum = character.Humanoid
cam = game.Workspace.CurrentCamera
function PlayerSetup()
	while true do
		hum.WalkSpeed = 0
		wait(.01)
	end
end
players.PlayerAdded:connect(PlayerSetup)

1 answer

You could always just anchor the Torso, then make the Camera's CameraType 'Scriptable'.


Here's a quick edit of your code with that added in:

players = game.Players
player = game.Players.LocalPlayer
character = player.Character
hum = character.Humanoid
cam = game.Workspace.CurrentCamera

function PlayerSetup()
	while true do
		Character.Torso.Anchored = true
		cam.CameraType = "Scriptable"
		wait()
	end
end

players.PlayerAdded:connect(PlayerSetup)

And there you go, that's it.


If you have any further problems/questions, please leave a comment below, and I'll see what I can do. Hope I helped :P

7 comments

0

should i do this in a local script

0

Yes. And make sure it's a decendent of the Player in some way.

0

should i put into the starter pack

0

I would put it into StarterGui

0

also theres now an issue when i use the A and D keys the movement comes back

0

scratch that. When i right click the movmemnt comeback

0

The camera movement, or the player movement?

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