Need help with ProximityPrompt Triggering a GUI

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)
1 Like

For UI to be changed you will to use a local script, you can fire a remote to the client when the prompt is triggered so the local script can change UI.

1 Like

I’m not looking to change the UI, I’m looking to clone the UI to PlayerGui when the ProximityPrompt is triggered, tween it onto the screen, and keep it on there until the CloseButton is pressed. However, the UI disappears completely off the screen after a few seconds of tweening it when nothing else in the script changes it without even hitting the CloseButton. And if you trigger the ProximityPrompt again while the UI is on the screen, it disappears and breaks the script at the same time.

The same way, fire remote to client and on the local script that receives it clone ui and all you want.