I’m trying to make a proximity prompt display a gui when triggered. It does that, but when the user attempts to do it a second time, nothing happens. Nothing shows in the output. I have tried loops, debounce methods, etc but I don’t really know what could be causing the issue. I have not tried breakpoints yet. Any ideas?
script.Parent.Triggered:Connect(function(plr)
if plr:GetRankInGroup(11639920) >= 3 and not plr.PlayerGui:FindFirstChild("CheckInMenu") then
local gui = game.ReplicatedStorage.CheckInMenu:Clone()
gui.Parent = plr.PlayerGui
gui.Bg:TweenPosition(UDim2.new(0.512, 0, 0.145, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 1.5)
else
return
end
end)
not plr.PlayerGui:FindFirstChild(“CheckInMenu”), this line checks if the player has the gui, if not then it will clone the gui to a player, so the first time you do it, it will work, but then i don’t see anything in your script that delete the gui afterwards, so the second time you do it, it doesn’t work because you already have the gui
If you’re destroying this cloned gui on the client-side (via a close button for instance), then its destruction will not replicate to the server, you either need to fire a RemoteEvent instance from this server script (which clones the gui into the player’s “PlayerGui” folder locally) or you’ll need to fire the server whenever the close button is pressed via a local script (which destroys the gui from the player’s “PlayerGui” folder on the server).