I want to make it so when you go into a shop the camera is locked into place
Like this:
robloxapp-20220130-0927300.wmv
make an event that triggers when someone enters the room, then simply change the camera cframe
Hi, to do this you gotta use a scriptable camera where you set the CFrame to a certain Position whilst also following the Player. Heres a script I have made for one of my games, Place it inside StarterPlayerScripts and its a local script:
local Camera = game.Workspace.CurrentCamera
local Lplayer = game.Players.LocalPlayer
local LCharacter = Lplayer.CharacterAdded:Wait()
local Lhead = LCharacter:WaitForChild("Head")
Camera.CameraSubject = LCharacter.HumanoidRootPart
Camera.CameraType = Enum.CameraType.Scriptable
Camera.FieldOfView = 80
local function onUpdate()
if Lplayer.Character and Lplayer.Character:FindFirstChild("HumanoidRootPart") then
Camera.CFrame = CFrame.new(Lplayer.Character.HumanoidRootPart.Position) * CFrame.new(0,5,12)
end
end
while true do
task.wait()
onUpdate()
end
Make sure to break out of the loop when not needed, change the CFrame to your desired Amount.
I used a while Loop but its better to use BindToRenderStep when working with camera.