Hi I want to make this script rotate the character’s camera to the left and then to the right, but it doesn’t work when it should work
Here is the script:
local RotatingValue = 0.01
local rus = game:GetService('RunService')
local plr = game.Players.LocalPlayer
while wait(1) do
RotatingValue = RotatingValue *(-1)
local cf: CFrame = CFrame.new(
0, 0, 0,
1, 0, RotatingValue,
0, 1, 0,
0, 0, 1
)
print(cf.ZVector.X)
print(RotatingValue)
local function cameraFunction()
workspace.CurrentCamera.CFrame *= cf
end
rus:BindToRenderStep(
'funny camera',
Enum.RenderPriority.Camera.Value + 1,
cameraFunction
)
end
And here is also a video:
The problem is when rotation value is set to -0.01 the camera is rotating but when it is set to 0.01 then it is not rotating
local Players = game.Players
local Player = Players.LocalPlayer
local RotatingValue = 0.01
local FlipFlop = 0
local rus = game:GetService('RunService')
local plr = game.Players.LocalPlayer
while wait(1) do
FlipFlop = FlipFlop + 1
if FlipFlop % 2 == 0 then
print("flip")
RotatingValue = RotatingValue *(-1)
else
print("flop")
RotatingValue = -RotatingValue *(-1)
end
local cf: CFrame = CFrame.new(
0, 0, 0,
1, 0, RotatingValue,
0, 1, 0,
0, 0, 1
)
local function cameraFunction()
workspace.CurrentCamera.CFrame *= cf
end
rus:BindToRenderStep(
'funny camera',
Enum.RenderPriority.Camera.Value + 1,
cameraFunction
)
end
All I did was add a flipflop value, basiaclly when it loops it add 1 to the value and checks if the value is either odd or even and if its odd it flips one way and if its even it flips the other.