Error:
code piece: camera.CFrame.Rotation.Y = math.clamp(tonumber(camera.CFrame.Rotation.Y),1,1.3)
i assigned camera to the currentcamera.
this is in a localscript
Basically, I am having trouble with locking my camera in a certain Y axis so the player cant see their body weirdly when sliding. I want the character to face forward in the same angle the whole duraction of the slide. How do I keep the Y between a certain range from changing due to player moving the camera?
The function:
RunService.RenderStepped:Connect(function(step)
-- anti camera clipping
local myRay = Ray.new(char.Head.Position, ((char.Head.CFrame + char.Head.CFrame.LookVector * 2) - char.Head.Position).Position.Unit)
local IL = char:GetChildren()
local hit, position = workspace:FindPartOnRayWithIgnoreList(myRay,IL)
if hit then
char.Humanoid.CameraOffset = Vector3.new(0,-1,-(char.Head.Position - position).magnitude)
elseif slideactive.Value == true then
char.Humanoid.CameraOffset = Vector3.new(0,-2,0)
camera.CFrame.Rotation.Y = math.clamp(tonumber(camera.CFrame.Rotation.Y),1,1.3)
else
char.Humanoid.CameraOffset = Vector3.new(0,-1,-1)
end
end)
im new to camera manipulation, i didnt really understand much of the dev wiki.