As you can see, the camera is always tweeting to the same CFrame even though the CFrames are different. I have no clue what’s causing this. In my script I am tweeting the camera to a certain CFrame every step using render stepped.
1 Like
This amount of information isn’t sufficient for anybody to work with. I understand your issue, however I have no idea how you’ve structured or written your code. Supply a sample of your code.
yeah sorry i was in a rush when I made the post
--done though a module script, called from a local script
local LimitRot = false
local RunService = game:GetService("RunService")
function limitCameraRotation.begin(Cframe)
print(Cframe) --here, it prints the correct CFrame
local camera = workspace.CurrentCamera
LimitRot = true
RunService.RenderStepped:Connect(function()
if LimitRot == true then
game:GetService("TweenService"):Create(camera, TweenInfo.new(.25), {CFrame = Cframe}):Play() -- but here, it always tweens to the same CFrame (the first locker you got in)
end
end)
end
function limitCameraRotation.resetRotation()
LimitRot = false
end
Could you supply a sample of where this function is initiated? The code you provided seems fine, just make sure to set the CameraType
to Enum.CameraType.Scriptable
when you’re manipulating the camera’s cframe.
server sided module handling the locker, animations, etc
game.ReplicatedStorage.Events.LockerEnter:FireClient(player, model.Base.CamHide.WorldCFrame)
local script handling the camera
lockerEnter.OnClientEvent:Connect(function(Cframe)
limitRot.begin(Cframe)
print(Cframe) -- prints correct CFrame
lockerLeave.OnClientEvent:Connect(function()
limitRot.End()
end)
end)