so im trying to tween the camera towards another part when you click a gui but it isnt working i think the problem is with the tween creation
my script:
local TweenService = game:GetService("TweenService") local object = script.Parent object.AnchorPoint = Vector2.new(0.5, 0.5) object.Position = UDim2.new(-3, 0, 0.5, 0) local cam = game.Workspace.CurrentCamera local FocusPart = game.Workspace.CamPart2 TweenInfo.new (3.0,Enum.EasingStyle.Quad,Enum.EasingDirection.Out, 0,false, 0 ) wait(7) object:TweenPosition(UDim2.new(0.5, 0, 0.5,0),Enum.EasingDirection.Out,Enum.EasingStyle.Back) local function onActivated() --part that isn't working cam.CameraSubject = FocusPart cam.CameraType = Enum.CameraType.Scriptable local tween = TweenService:Create(cam,TweenInfo,{CFrame = FocusPart.CFrame} ) tween:Play() end object.Activated:Connect(onActivated)
TweenInfo is an enum not a setting
local TweenService = game:GetService("TweenService") local object = script.Parent object.AnchorPoint = Vector2.new(0.5, 0.5) object.Position = UDim2.new(-3, 0, 0.5, 0) local cam = game.Workspace.CurrentCamera local FocusPart = game.Workspace.CamPart2 local Info = TweenInfo.new (3.0,Enum.EasingStyle.Quad,Enum.EasingDirection.Out, 0,false, 0 ) wait(7) object:TweenPosition(UDim2.new(0.5, 0, 0.5,0),Enum.EasingDirection.Out,Enum.EasingStyle.Back) local function onActivated() cam.CameraSubject = FocusPart repeat cam.CameraType = Enum.CameraType.Scriptable until cam.CameraType == Enum.CameraType.Scriptable local tween = TweenService:Create(cam,Info,{CFrame = FocusPart.CFrame} ) tween:Play() end object.Activated:Connect(onActivated)
Make sure it's in a local script, not in a serverscript.