Hello! I'm trying to enable filtering to make sure my game can be opened again (ugh) as roblox has demanded it. The script below is supposed to make the button say 'close' and a gui frame appear when someone clicks on it, unfortunately it does not. All three print tests appear in output and nothing seems to affect anything else. Note: considering roblox has shut down the game, I can only test this in studio test mode, would this have an effect on it?
script.Parent.MouseButton1Click:connect(function()
if game.StarterGui.Customizer.CloseTab.Text == 'Open' then
print("1")
game.StarterGui.Customizer.CloseTab.Text = 'Close'
print("2")
game.StarterGui.Customizer.PositioningFrame.Visible = true
print("3")
game.StarterGui.Customizer.CloseTab.Text = 'Close'
else
game.Workspace.CloseGUIEvent:FireServer()
end
end)
Also tried with a remote event, also prints but won't work:
this is the script for the event
local event = Instance.new("RemoteEvent")
event.Name = "OpenGUIEvent"
event.Parent = game.Workspace
game.Workspace.OpenGUIEvent.OnServerEvent:connect(function()
print("1")
game.StarterGui.Customizer.PositioningFrame.Visible = true
print("2")
end)
and the one that runs it
script.Parent.MouseButton1Click:connect(function()
if game.StarterGui.Customizer.CloseTab.Text == 'Open' then
game.Workspace.OpenGUIEvent:FireServer()
else
game.Workspace.CloseGUIEvent:FireServer()
end
end)

12 comments
https://scriptinghelpers.org/blog/common-mistakes#PlayerGui
This script worked fine when filteringenabled was off, I don't think getting it confused with playergui was the issue
Oh it's definitely the issue, you used StarterGui instead of PlayerGui
Yes because the text I'm trying to edit is inside StarterGUI and I can't access it from PlayerGui
There's never been any sort of problem with accessing the starterGUI through 'game.StarterGui. etc
PlayerGui is the best way/ standard method to use to access player the player's GUI - definitely go with PlayerGui - you'll have more success with it.
Alright, I've literally no idea how to put something into PlayerGui
If you're using a LocalScript, then you can access the PlayerGui by using "game.Players.LocalPlayer.PlayerGui"
Also, events should be placed in ReplicatedStorage, not Workspace. [That's how it usually works]
You are supposed to be using PlayerGUI because that is where the GUI your player is interacting with is located. The StarterGUI is where the GUI that is supposed to be replicated to all new players is located.
Putting events in workspace won't change how they work, I'm just trying to get it to function so I can neaten things up and put it in ReplicatedStorage once the script is sound
I've used PlayerGui now, it has literally no impact on the script. It still won't function