Cant execute the script twice

I am trying to do a script but for some reason the so called script does no fire twice. It runs first time completely fine but second time, na-da. heres the script,

local prompt = script.Parent.ProximityPrompt

prompt.Triggered:Connect(function(plr)
	plr.PlayerGui.TP.Frame22.Visible = true
end)

Its supposed to set visibility of “Frame22” to true but when I close the GUI, it wont open again.

If the GUI closes through a LocalScript, it would mean the Server is still thinking the GUI is open, because there isn’t any communication to indicate to the Server that the Player has closed a GUI.

To counter this, utilise RemoteEvents, and fire RemoteEvents from the Client through the Server, to indicate to the ServerScript when it receives the RemoteEvent that the GUI is closed.

1 Like

is there any other way I can do this without RemoteEvents?-

prompt.Triggered:Connect(function(plr)
	plr.PlayerGui.TP.Frame22.Visible = not plr.PlayerGui.TP.Frame22.Visible
end)
1 Like

Thanks a lot dude, saved me from 1 hour problem o7

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