Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

TweenService opening gate doesn't work?

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)

1 comment

0

Tweens don't automatically yield, you'll have to add a wait(4) before starting the second tween

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.