Why does it only tween once?

So im trying to make a tween position for a gui when the player touches the part and im useing flags aka Debounces. And it only runs the tween once. I also have a local script that removes the gui when you press exit button just incase thats the problem

local part = script.Parent
local flag = true

part.Touched:Connect(function(hit)
	local plr = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
	if plr and flag then
		plr.PlayerGui.BuyGui.Frame:TweenPosition(UDim2.new(0.287, 0, 0.325, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.5)
		flag = false
		print("yes")
		wait(1)
		flag = true
	end
end)

Looks like second time you tween the position is already set to the same position as after the first tween. In that case the tween does nothing because the target is already reached.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.