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

My code is not changing the camera's Cframe?

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:

local camera = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer


-- Listen for the player's character changing
player.CharacterAdded:Connect(function(character)
	wait(5)
	print("here")
	print(camera.CFrame)
	camera.CFrame = camera.CFrame * CFrame.new(1.7,0,0)
	print(camera.CFrame)
end)

1 answer

You need to make sure the CameraType is scriptable.

local Player = game:GetService('Players').LocalPlayer
local Camera = workspace.CurrentCamera

local Character = Player.Character or Player.CharacterAdded:Wait()

task.wait(5)
print('here')
print(Camera.CFrame)
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = Camera.CFrame * CFrame.new(1.7,0,0)
print(Camera.CFrame)

1 comment

0

I figured this out but how do i make the camera follow the player

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