Issue with UI not opening

I have tried to solve it on my own but it doesnt wanna work.
I have a ProximityPrompt and when you click E a UI opens.

It works perfectly fine the first time, but the second time it doesnt wanna work. It doesn’t make any sense.
Here is the code I have:

local armoredDiv = 0000

script.Parent.Triggered:Connect(function(plr)
	if plr:IsInGroup(armoredDiv) or plr:GetRankInGroup(33488955) >= 50 then
	print(plr.Name.." is pressing.")
	plr.PlayerGui.TankSpawner.Frame.Visible = true
	end
end)

And it literally prints “rasm123z is pressing” so it knows its my character, but for whatever reason it doesnt wanna show the frame the second time after closing it.

1 Like

Are you closing on the local script?

1 Like

Ye it is.
asdhbasdhbasdhibaoshaisbd

closing on local script is a way too close the gui.but server will not see its closed.server already opened it for you.but server still detects its opened.just copy and paste this:

local armoredDiv = 0000

script.Parent.Triggered:Connect(function(plr)
	if plr:IsInGroup(armoredDiv) or plr:GetRankInGroup(33488955) >= 50 then
	print(plr.Name.." is pressing.")
	plr.PlayerGui.TankSpawner.Frame.Visible = false
        plr.PlayerGui.TankSpawner.Frame.Visible = true
	end
end)
1 Like

Send a screenshot of the script that closes this UI.
also asking for clarification the code you sent is in a local script and the script that closes the UI is also a local script right?

1 Like

This is probably because you are opening the UI on the server, and then closing it on the client via a local script. When you close the UI on client, the server still thinks the UI is visible. This means the server won’t make the UI visible again. To fix this, make the “close button” localscript a server script.

No, the script provided above is in a ServerScript, and the close UI is in a local script.

LocalScript: (StarterGui.Button)

script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent.Visible = false
end)

Server Script: (Part.ProximityPrompt.Script)

local armoredDiv = 0000

script.Parent.Triggered:Connect(function(plr)
	if plr:IsInGroup(armoredDiv) or plr:GetRankInGroup(33488955) >= 50 then
	print(plr.Name.." is pressing.")
	plr.PlayerGui.TankSpawner.Frame.Visible = true
	end
end)

I have updated the following:

I am now firing a remoteevent in a local script when it gets closed, then in a server script i am closing the frame using playergui.TankSpawner.Frame.

I think this should work, let me know if there are any issues with doing it this way.

why dont you close the gui on server before opening it for player? i use this so i dont need remote events.

plr.PlayerGui.TankSpawner.Frame.Visible = false
plr.PlayerGui.TankSpawner.Frame.Visible = true

also have you tried my updated one?it should work.

I would make the LocalScript in the Button a server script. A RemoteEvent is not necessary.