I have a GUI to give players tools and the GUI opens when a player triggers the ProximityPrompt, but the GUI only wants to open once and after you close it you cannot open it again.
The expected behavior is that the GUI should open whenever you press the Prompt.
Current behaviour where the GUI refused to open again after it is opened once:
PromimityPrompt Code:
script.Parent.Triggered:Connect(function(plr)
if plr.TeamColor == game.Teams["Royal Canadian Mounted Police"].TeamColor then
plr.PlayerGui.RCMPToolGUI.MainFrame.Visible = false
plr.PlayerGui.RCMPToolGUI.MainFrame.Visible = true
plr.PlayerGui.RCMPToolGUI.MainFrame:TweenPosition(UDim2.new(0.393, 0,0.176, 0))
end
end)
I suspect that this is because you’re using a server script for the ProximityPrompt, which is directly changing the position of the frame from the server, while the close button code is in a local script.
Whatever changes to the GUI the local script does to the GUI doesn’t reflect on the server, so calling TweenPosition again in the server script doesn’t do anything since the server thinks it’s at the same position as before.
The simplest solution, if you only need it for this one part (which I assume since you’re just using script.Parent.Triggered), is to use a RemoteEvent that tells the client to make the gui visible. If you have multiple of these, I suggest you look into using ProximityPromptService in a relevant local script.
Actually scratch that, I forgot this is a thing because I’ve never used it, but the actual simplest solution in this case is changing the script’s RunContext property from Legacy to Client.