Hi! I have this cutscene that moves from p1 to p2. However, i cant get the cutscene to stop when i press play? Any ideas? Thanks in advance!
local camera = workspace.CurrentCamera local player = game.Players.LocalPlayer local char = player.Character local p1 = workspace.Cutscene.cam1 local p2 = workspace.Cutscene.cam2 local playbutton = script.Parent.ClearFrame.PlayButton repeat wait() camera.CameraType = Enum.CameraType.Scriptable until camera.CameraType == Enum.CameraType.Scriptable camera.CFrame = p1.CFrame local function TweenCamera(pos) local TweenService = game:GetService("TweenService") local TweenInf = TweenInfo.new(5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0) local Tween = TweenService:Create(camera, TweenInf, {CFrame = pos}) Tween:Play() end wait(2) TweenCamera(p2.CFrame) playbutton.MouseButton1Click:Connect(function() camera.CameraType = Enum.CameraType.Custom script.Parent.ClearFrame.Visible = false coroutine.yield(TweenCamera) end)
Hi!! I figured it out! Sooooo, set
local Tween = TweenService:Create(camera, TweenInf, {CFrame = pos})
to
Tween = TweenService:Create(camera, TweenInf, {CFrame = pos})
and then at the top write
Tween = nil
finally in
playbutton.MouseButton1Click:Connect(function() camera.CameraType = Enum.CameraType.Custom script.Parent.ClearFrame.Visible = false coroutine.yield(TweenCamera) end)
replace
coroutine.yield(TweenCamera)
with
Tween:Cancel()
Hope this helps people in the future!