I am trying to make a ProximityPrompt work with a GUI that is located within ServerStorage. I am trying to make it so when a player triggers the ProximityPrompt, the GUI clones to PlayerGui, tweens onto the screen, and the GUI stays up until the player hits the CloseButton located in the GUI. When the CloseButton is hit, the GUI tweens back off the screen, then a few seconds later its destroyed.
However, the issue that I am having is that a few seconds after the GUI tweens, the GUI just disappears completely. Even if you trigger the ProximityPrompt again while the GUI is up, the GUI eventually disappears as well. And when triggering the ProximityPrompt for the third time, the script is completely broken at this point so I am stumped on what is the actual issue. Even after trying 3 other methods of scripting it, it still comes out with the same result.
Video of the issue:
Script:
local VehicleDealershipScreen = game.ServerStorage.VehicleDealershipScreen
script.Parent.Triggered:Connect(function(player)
if not player.PlayerGui:FindFirstChild("VehicleDealershipScreen") then
VehicleDealershipScreen:Clone().Parent = player.PlayerGui
player.PlayerGui.VehicleDealershipScreen.VehicleDealershipFrame:TweenPosition(
UDim2.new(0, 0, 0, 0),
"Out",
"Quad",
2,
true
)
end
end)