Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How can I halt this camera tween function after the player exits the menu?

Asked by
Azuc 112
6 years ago

Basically we are working on updating the camera in our game for our menu from being a static position to flying between positions, the issue we are currently having is once the player leaves the menu the camera will go back to the player like it should be it instantly starts flying to the spots outlined in the tween function until the wait statements have finished.

Not really sure how to break the function once the player spawns, some input would be greatly appreciated:

01local Camera = game.Workspace.CurrentCamera
02local Tween = game:GetService("TweenService")
03 
04function zoomToCam(part, seconds)
05    Tween:Create(Camera, TweenInfo.new(seconds), {CoordinateFrame = part.CFrame}):Play()
06end
07 
08local TweenMenu = function(Value)
09    local Camera = game.Workspace.CurrentCamera
10    local CameraStart = game.Workspace:WaitForChild("CameraPart")
11    local Angle = 0
12 
13 
14    Menu.Visible = Value
15    Background.Visible = Value
View all 41 lines...

1 answer

Log in to vote
1
Answered by
WoolHat 53
6 years ago
Edited 6 years ago

I actually encountered this same thing before. Roblox makes you go insane finding this page. Try googling it, it hardly exists.

http://wiki-origin.roblox.com/index.php?title=API:Class/Tween

You should place your neonate into a variable and subsequently play it. Later on, you can reference that same neonate, but instead use Cancel()

Hope this helps.

Ad

Answer this question