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

ANSWERED How do I make it so the player cant move the camera and also lock someone into a seat?

I am working on a project that is like a waiting simulator, and I need this code!

Thanks!

1 answer

✓ Accepted answer

Hi promaster1111,

You can stop the player from moving their camera by just turning the CameraScript off. This script is located in PlayerScripts under the Player. So, its specific location is:

Players > Player > PlayerScripts > CameraScript

###Just disable that script. So, the code would look something like this:

####Local Script Inside StarterGui

local players = game:GetService("Players");
local player = players.LocalPlayer;
local cam_script = player:WaitForChild("PlayerScripts"):WaitForChild("CameraScript");

cam_script.Disabled = true;

###As for how to make players sit in a seat, I recommend disabling the control script, so that players can't control the Character, and then teleporting them to the seat. So, the ControlScript is located in PlayerScripts as well. It's specific location is:

Players > Player > PlayerScripts > ControlScript

###Just disable that script and you should be able to restrict the Players' movement, and then you just teleport the player to the seat using CFrame. Here's how it would look in code.

####Local Script Inside StarterGui

local players = game:GetService("Players");
local player = players.LocalPlayer;
local char = player.Character or player.CharacterAdded:Wait();
local root = char:WaitForChild("HumanoidRootPart");
local seat = workspace.Seat; -- This is the seat.
local control_script = player:WaitForChild("PlayerScripts"):WaitForChild("ControlScript");

control_script.Disabled = true;
root.CFrame = seat.CFrame;

##Hope I helped and have a wonderful day/night.

Thanks,

Best regards,

~~ KingLoneCat

8 comments

0

Btw, if you want to allow players to be able to move again and move their camera, just make the scripts' Disabled property false.

0

Good answer.

0

Thanks.

0

Thanks!

0

No problem.

0

Wait, should local seat = workspace.Seat; have a capital W?

0

Wait, YOU SPELLED MY NAME WRONG?! I'M SO MAD RIGHT NOW! YOU FORGOT A 1!

0

Never use capital W when addressing just the workspace. You don't need to use it unless you're doing like game.Workspace. But, you can just say workspace. Also, sorry for the misspell. Usually I use the first part of peoples' name not the whole thing.

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