Properties of a Tween?

hey there! I can’t seem to find the proper TweenStatus property in a Tween.

Code [Inside of a tornado]:

local minX = -253.99
local maxX = 253.99
local minZ = -254.97
local maxZ = 254.97
local X = math.random(minX, maxX)
local Z = math.random(minZ, maxZ)
local Y = 75.015
local tweenService=  game:GetService("TweenService")
local tweenInfo = TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0)
local tween = tweenService:Create(script.Parent.HumanoidRootPart, tweenInfo, {Position = Vector3.new(X,Y,Z)})
function fired()
	wait(0.5)
	tween:Play()
	repeat wait() until tween.TweenInfo == Enum.TweenStatus.Completed
	script.Parent.FunnelMove:Fire()
end
script.Parent.FunnelMove.Event:connect(fired)

Thanks for any help! :slight_smile:

1 Like

Judging from the code, you wish to wait until a tween is finished?

instead of repeat wait() until, just use the Tween.Completed Event

function fired()
	wait(0.5)
	tween:Play()
	tween.Completed:Wait()
	script.Parent.FunnelMove:Fire()
end

6 Likes

the property your looking for is this:

Tween.PlaybackState
--so you should say this
repeat wait() until Tween.PlaybackState == Enum.PlaybackState.Completed

Why reinvent the wheel when the signal Tween.Completed exists? A loop here is pointless. mathymods hits it on the nose that you can just attach wait to the signal so the thread yields until the signal is fired.

2 Likes