Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My code is not changing the camera's Cframe?

Asked by
Cikeruw 14
2 years ago

My code is supposed to mimic shift lock. But the camera is not changing for some reason. Could someone please help me out?

Here is my code:

01local camera = game.Workspace.CurrentCamera
02local player = game.Players.LocalPlayer
03 
04 
05-- Listen for the player's character changing
06player.CharacterAdded:Connect(function(character)
07    wait(5)
08    print("here")
09    print(camera.CFrame)
10    camera.CFrame = camera.CFrame * CFrame.new(1.7,0,0)
11    print(camera.CFrame)
12end)

1 answer

Log in to vote
0
Answered by
pwx 1581 Moderation Voter
2 years ago

You need to make sure the CameraType is scriptable.

01local Player = game:GetService('Players').LocalPlayer
02local Camera = workspace.CurrentCamera
03 
04local Character = Player.Character or Player.CharacterAdded:Wait()
05 
06task.wait(5)
07print('here')
08print(Camera.CFrame)
09Camera.CameraType = Enum.CameraType.Scriptable
10Camera.CFrame = Camera.CFrame * CFrame.new(1.7,0,0)
11print(Camera.CFrame)
0
I figured this out but how do i make the camera follow the player Cikeruw 14 — 2y
Ad

Answer this question