local Prox = script.Parent
local GUI = script.Parent:FindFirstChildOfClass("ScreenGui")
local Clone = GUI:Clone()
Clone.Parent = Prox
Prox.Touched:Connect(function(hit)
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
Clone.Parent = Player.PlayerGui
local Tween = Clone.Image:TweenPosition(UDim2.new(-0, 0, 0.890, 0),"Out", "Sine", 1)
Prox.TouchEnded:Connect(function(hit2)
if hit == hit2 then
local Tween2 = Clone.Image:TweenPosition(UDim2.new(-0, 0, 1, 0),"In", "Sine", 1)
end
end)
end)
The fifth parameter of the GuiObject:TweenPosition function can be set to a bool to determine if the tween should override a tween in progress.
local Prox = script.Parent
local GUI = script.Parent:FindFirstChildOfClass("ScreenGui")
local Clone = GUI:Clone()
Clone.Parent = Prox
Prox.Touched:Connect(function(hit)
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
Clone.Parent = Player.PlayerGui
local Tween = Clone.Image:TweenPosition(UDim2.new(-0, 0, 0.890, 0),"Out", "Sine", 1, true)
Prox.TouchEnded:Connect(function(hit2)
if hit == hit2 then
local Tween2 = Clone.Image:TweenPosition(UDim2.new(-0, 0, 1, 0),"In", "Sine", 1, true)
end
end)
end)
local Prox = script.Parent
local GUI = script.Parent:FindFirstChildOfClass("ScreenGui")
local Clone = GUI:Clone()
Clone.Parent = Prox
Prox.Touched:Connect(function(hit)
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
Clone.Parent = Player.PlayerGui
local Tween = Clone.Image:TweenPosition(UDim2.new(-0, 0, 0.890, 0),"Out", "Sine", 1, true)
Prox.TouchEnded:Connect(function(hit2)
if hit == hit2 then
if Tween then
local Tween2 = Clone.Image:TweenPosition(UDim2.new(-0, 0, 1, 0),"In", "Sine", 1)
end
end
end)
end)
local Prox = script.Parent
local GUI = script.Parent:FindFirstChildOfClass("ScreenGui")
local Clone = GUI:Clone()
Clone.Parent = Prox
Prox.Touched:Connect(function(hit)
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
Clone.Parent = Player.PlayerGui
local Tween = Clone.Image:TweenPosition(UDim2.new(-0, 0, 0.890, 0),"Out", "Sine", 1, true)
Prox.TouchEnded:Connect(function(hit2)
if hit == hit2 then
if Tween then
Tween = nil
Tween = Clone.Image:TweenPosition(UDim2.new(-0, 0, 1, 0),"In", "Sine", 1, true)
end
end
end)
end)