If a player presses a button, how do I make the camera move to the part? I used the script below, but whenever I press play, it does nothing but makes the button invisible. How do we fix this?

local camera = workspace.CurrentCamera
local mainMenuMap = workspace:WaitForChild("MainMenuMap")
local tweenService = game:GetService("TweenService")


function tweenCamera(pos,tweenTime)
 tweenService:Create(camera,TweenInfo.new(tweenTime,Enum.EasingStyle.Linear),{CFrame = pos.CFrame}):Play()
end

script.Parent.MouseButton1Click:Connect(function()
 script.Parent.Visible = false
 script.Parent.Parent.Title.Visible = false
script.Parent.ShopButton.Visible = false
 tweenCamera(mainMenuMap.CameraPart2,1)
 wait(1)
 print("Reached Destination")
end)

1 comment

0

Use Camera:Interpolate()