Hello,

I'm making a shop in my game and I would like to tween the camera to a different location when a button is clicked. Here is my script:

local button = script.Parent
local camera = workspace.CurrentCamera

local TweenService = game:GetService("TweenService")

camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = workspace.Warehouse.LobbyCamera
camera.CFrame = workspace.Warehouse.LobbyCamera.CFrame

local Info = TweenInfo.new(
	3,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.In,
	0,
	false,
	0.5
)

local camTween = TweenService:Create(camera, Info, {CFrame = workspace.ShopCamera.CFrame})

button.MouseButton1Click:Connect(function()
	button.Parent.Visible = false
	camTween:Play()
end)

For some reason it was working before but when I came back and tried it it stopped working. There is no error in the output so I'm not sure what I should do.

If anyone could help I would be very appreciative. Thank you!

2 comments

0

Try printing

0

I've tried and it prints but doesn't tween.