So i’m making an arcade in my game, and basically im making a gui game thingy, and i’m probably gonna post more bc im bad at scripting, but the gui isn’t showing up bc “RedButton1 is not a valid member of Workspace” When It clearly is .__.
game.Workspace.RedButton1.ClickDetector.MouseClick:Connect(function()
--
if player.PlayerGui.MiniGame.Game.Visible == false then
--
player.PlayerGui.MiniGame.Game.Visible = true
else
player.PlayerGui.MiniGame.Game.Visible = false
end
end)
The reason your script doesn’t work is because you never defined “player.” Player will be the parameter in the .MouseClick event, so you should change function() to function(player).
Also, to make your script easier, you can just do this (not required):
game.Workspace.RedButton1.ClickDetector.MouseClick:Connect(function(player)
player.PlayerGui.MiniGame.Game.Visible = not player.PlayerGui.MiniGame.Game.Visible
end)
Then try game.Workspace:WaitForChild(“RedButton1”). If that doesn’t work either, then you simply don’t have anything in the workspace called “RedButton1”
You may have workspace.StreamingEnabled set to true. With StreamingEnabled, parts/models don’t replicate to your client until you are near them. I wouldn’t recommend disabling it if you have a large detailed map though, as keeping it enabled improves join times and can reduce lag.
Also, be careful accessing that by name, because a player named “RedButton1” could potentially break your game. Consider “_RedButton1” instead.
There’s a chance your script isn’t compatible to reach parts like that. I’m not good at scripting, but I sometimes get errors saying something isn’t there when clearly it was . Try using a Local Script for this. If your script is in StarterGui which I suppose it isn’t then that would probably be the problem here. Anyways Good Luck and Keep Learning!
thaNK YOU so MUCHHCKDJSHGKSDJFHGJKLSD
IVE HAD A lot of wifi problems so working in studio has been FRUSTRATING, and this WORKED. T H A N K Y O U MR. SQUAREPAPYRUS