I've recently made a script that is placed into a part. The script is supposed to make it so whenever you touch the part with your character it enables the visibility of a gui that every player starts out with. I'd also like to note that the gui's visibility is set to false by default. The script works as planned the first time but when I close the gui and touch the part again it does not reappear like I want it to. The gui has a "close" button that just sets the visibility back to false so It should be reappearing when touching the part again. Here is the script:
local Part = script.Parent
Part.Touched:connect(function(HIT)
local H = HIT.Parent:FindFirstChild("Humanoid")
if H then
local Player =game.Players:GetPlayerFromCharacter(HIT.Parent)
Player.PlayerGui.Glowsticks.Frame.Visible = true
end
end)
Here is the close button localscript inside the gui:
function onButtonClicked()
script.Parent.Parent.Visible = false
end
script.Parent.MouseButton1Click:connect(onButtonClicked)

11 comments
What do you mean?
Nvm my page wasnt loaded I didnt see your edit
oh ok
Any progress?
Doesnt seem to be working for me. I made a remote event and named it "GlowstickEvent", renamed it in the scripts aswell and it isnt working
Whats the error?
Players.Dxligent.PlayerGui.Glowsticks.Frame.Close.LocalScript:2: attempt to index nil with 'PlayerGui'
try the edited version
Works Great! Thanks for the help. Ill make sure to accept your answer
Thanks!
The issue was that he was setting the visibility to false on the client, whilst the visibility was still set to true on the server. So when he touched the part again, it didn't set it to true for him, even though it was set to false on his client, but on the server it was still set to true. This also could've been fixed by changing the local script in the button to a server script.