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

TweenService opening gate doesn't work?

Asked by 3 years ago

Hello, I've been trying to make a gate that opens vertically. Yet it doesn't work at all.

script.Parent.PromptButtonHoldEnded:Connect(function(plr)
    local original = script.Parent.Parent
    local up = script.Parent.Parent.Parent.Arrival

    if plr.Team ~= game.Teams.CD then
        local goalData = {CFrame = up.CFrame}

        local tween = game.TweenService:Create(script.Parent.Parent,TweenInfo.new(4),goalData)
        tween:Play()

        goalData = {CFrame = original.CFrame}
        local tween = game.TweenService:Create(script.Parent.Parent,TweenInfo.new(4),goalData)
        tween:Play()
        print("hi")
    end
end)
0
Tweens don't automatically yield, you'll have to add a wait(4) before starting the second tween the8bitdude11 358 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

Tween's have an event called completed()

We can use this to yield:


Tween.Completed:Wait()

This will wait until the tween has finished its animation

Ad

Answer this question