✓ Accepted answer
So there are a few issues that arise from the way you are approaching this.
- You cannot access individual player's GUI directly from the server.
A player's GUI does not replicate with the server (and rightly so). There's no point in that information being sent to the server as unlike work geometry, physics, etc. Literally only the individual player is going to see their GUI.
The solution to this would be to either use a remote event (which i'd argue is overly complicated) or to use a local script.
local colorFrame = game.Players.LocalPlayer.PlayerGui:WaitForChild("Colorgui"):WaitForChild("Frame")
game.Workspace.ExampleButton.ClickDetector.MouseClick:Connect(function(player)
colorFrame.Visible = true
end)
- Even if 1. wasn't a problem you are connecting an event to the click detector each time a player joins the game.
This is problematic as anytime anyone clicks the part then everyone's GUI will be affected.
If this is your intention then you should connect 1 event on the server and use a remote event and the FireAllClients method to replicate the change to every player.
1 comment
Use a remote event.