Gui disseppears after tweening

What is the wrong with this code?

local gui = game:GetService("Players").LocalPlayer.PlayerGui.gui2.kapigecisgui
local proxydoorbiric = game.Workspace:WaitForChild("door1ic").ProximityPrompt
local proxydoorbirdis = game.Workspace:WaitForChild("door1dis").ProximityPrompt
local proxydoorikiic = game.Workspace:WaitForChild("door2ic").ProximityPrompt
local proxydoorikidis = game.Workspace:WaitForChild("door2dis").ProximityPrompt

proxydoorbiric.Triggered:Connect(function()
	gui:TweenPosition(UDim2.new(-0.7, 0, 0.5, 0), "InOut", "Quad", 1.5, true)
	gui.Position = UDim2.new(1.7,0 , 0.5, 0)
end)

proxydoorbirdis.Triggered:Connect(function()

	gui:TweenPosition(UDim2.new(-0.7, 0, 0.5, 0), "InOut", "Quad", 1.5, true)
	gui.Position = UDim2.new(1.7,0 , 0.5, 0)

end)

proxydoorikiic.Triggered:Connect(function()

	gui:TweenPosition(UDim2.new(-0.7, 0, 0.5, 0), "InOut", "Quad", 1.5, true)
	gui.Position = UDim2.new(1.7,0 , 0.5, 0)

end)

proxydoorikidis.Triggered:Connect(function()
	
	gui:TweenPosition(UDim2.new(-0.7, 0, 0.5, 0), "InOut", "Quad", 1.5, true)
	gui.Position = UDim2.new(1.7,0 , 0.5, 0)

end)
1 Like

By the way gui is still visible after tweening but its not appear

1 Like

Why are you setting the Position of the gui after tweening it? That doesn’t make any sense (atleast from what I see). You’re setting the position of the gui outside of the player’s screen in both the tween and value assignment

Because i want make this tween reusable

local TweenService = game:GetService("TweenService")
local tweeninfo = {
	1.5,
	Enum.EasingStyle.Quad,
	Enum.EasingDirection.Out
}
local Tween = TweenService:Create(gui,TweenInfo.new(tweeninfo),{Position = UDim2.new(-0.7, 0, 0.5, 0)})
Tween.Completed:Connect(function()
	gui.Position = UDim2.new(1.7,0 , 0.5, 0)
end)

I recommend you use TweenService as it’s always better if you want to learn more about it here TweenService | Documentation - Roblox Creator Hub

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