I want to make a ring select for a tower game that switches through rings if you click the forward and back buttons. I’m using tweens for this and I am moving the camera.
When I press the button, the tween doesn’t work. There are no errors, and I don’t know why it isn’t. This is what it’s supposed to do:
(poorly acted depiction haha)
This is the script:
local tweenservice = game:GetService("TweenService")
local cam = workspace.Camera
local scenes = workspace.CamScenes
local screengui = game.StarterGui.ScreenGui
local RingUp = screengui.RingUp
local RingDown = screengui.RingDown
local tween1 = tweenservice:Create(cam,TweenInfo.new(1,Enum.EasingStyle.Exponential),{CFrame = scenes["1"].CFrame})
local tween2 = tweenservice:Create(cam,TweenInfo.new(1,Enum.EasingStyle.Exponential),{CFrame = scenes["2"].CFrame})
local tween3 = tweenservice:Create(cam,TweenInfo.new(1,Enum.EasingStyle.Exponential),{CFrame = scenes["3"].CFrame})
local tween4 = tweenservice:Create(cam,TweenInfo.new(1,Enum.EasingStyle.Exponential),{CFrame = scenes["4"].CFrame})
local tween5 = tweenservice:Create(cam,TweenInfo.new(1,Enum.EasingStyle.Exponential),{CFrame = scenes["5"].CFrame})
local tween6 = tweenservice:Create(cam,TweenInfo.new(1,Enum.EasingStyle.Exponential),{CFrame = scenes["6"].CFrame})
local ringnum = 1
repeat wait() until cam.CameraSubject ~= nil
cam.CameraType = Enum.CameraType.Scriptable
cam.CFrame = scenes["1"].CFrame
RingUp.MouseButton1Click:Connect(function()
if ringnum == 1 then
tween2:Play()
ringnum = 2
elseif ringnum == 2 then
tween3:Play()
ringnum = 3
elseif ringnum == 3 then
tween4:Play()
ringnum = 4
elseif ringnum == 4 then
tween5:Play()
ringnum = 5
elseif ringnum == 5 then
tween6:Play()
ringnum = 6
end
end)
RingDown.MouseButton1Click:Connect(function()
if ringnum == 6 then
tween5:Play()
ringnum = 5
elseif ringnum == 5 then
tween4:Play()
ringnum = 4
elseif ringnum == 4 then
tween3:Play()
ringnum = 3
elseif ringnum == 3 then
tween2:Play()
ringnum = 2
elseif ringnum == 2 then
tween1:Play()
ringnum = 1
end
end)
Thank you!