I’m trying to loop the CFrame by Rotating and using button but it doesn’t loop right
If I go right then go left it wont go to the middle but just go to the left
I researched how to do CFrames by using the wiki and by reading post but it doesn’t help me
Im trying to make this:
I figured out the problem, here’s the script i made for people who need help
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local cam = workspace.CurrentCamera
local Part = game.Workspace.Office1Focus
local TweenService = game:GetService(“TweenService”)
local LeftArrow = script.Parent.LeftTurn
local RightArrow = script.Parent.RightTurn
local tween = TweenService:Create(
cam,
TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
{
CFrame = workspace.Office1Focus.CFrame * CFrame.Angles(0, math.rad(-90), 0),
Focus = Part.CFrame
}
)
local tween2 = TweenService:Create(
cam,
TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
{
CFrame = workspace.Office1Focus.CFrame * CFrame.Angles(0, math.rad(0), 0),
Focus = Part.CFrame
}
)
local tween3 = TweenService:Create(
cam,
TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
{
CFrame = workspace.Office1Focus.CFrame * CFrame.Angles(0, math.rad(90), 0),
Focus = Part.CFrame
}
)
local Looking = 0
enabled = true
RightArrow.MouseEnter:Connect(function()
print(enabled)
if not enabled then
return
end
print(enabled)
enabled = false
if Looking == -1 or Looking == -2 then
tween2:Play()
-- cam.CFrame = workspace.Office1Focus.CFrame * CFrame.Angles(0, 0, 0)
LeftArrow.Visible = true
Looking = 0
wait(0.5) enabled = true print(enabled)
else
Looking = Looking + 1
tween:Play()
--cam:Interpolate(Part.CFrame,Part.CFrame * CFrame.Angles(0, math.rad(-90), 0),5)
--cam.CFrame = workspace.Office1Focus.CFrame * CFrame.Angles(0, math.rad(-90), 0)
RightArrow.Visible = false
wait(0.5) enabled = true print(enabled)
print(Looking)
end
end)
LeftArrow.MouseEnter:Connect(function()
print(enabled)
if not enabled then
return
end
enabled = false
print(enabled)
if Looking == 1 or Looking == 2 then
tween2:Play()
--cam.CFrame = workspace.Office1Focus.CFrame * CFrame.Angles(0, 0, 0)
RightArrow.Visible = true
Looking = 0
wait(0.5) enabled = true print(enabled)
else
Looking = Looking - 1
tween3:Play()
--cam.CFrame = workspace.Office1Focus.CFrame * CFrame.Angles(0, math.rad(90), 0)
LeftArrow.Visible = false
wait(0.5) enabled = true print(enabled)
print(Looking)
end
end)