I have a code inside a script, inside a ClickDetector, inside a part. When I click the part it should open a Gui which is inside the PlayerGui Folder but I just get the error; InfoGui is not a valid member of PlayerGui
But if I look ínside the PlayerGui Folder it is there! It is spelled correctly, I've checked many times but the script can't find it!
Here's the script;
script.Parent.MouseClick:Connect(function(player) player.PlayerGui.InfoGui.ImageLabel.Visible = true end)
The server can't see each clients' PlayerGui's descendants, so you're gonna need a RemoteEvent for this.
We'll need to handle the event on the client using the OnClientEvent event. There we'll enable the player's gui when we fire the event:
-- This will be your client code local RE = game.ReplicatedStorage:WaitForChild('RemoteEvent') -- assuming you've created a RemoteEvent local gui = script.Parent -- Assuming this script was parented to the ImageLabel you're making visible RE.OnClientEvent:Connect(function() gui.Visible = true end)
Then, we'll handle the ClickDetector's mouse event on the server and fire the event to the client who clicked it:
--This will be your server code local RE = game.ReplicatedStorage:WaitForChild('RemoteEvent') script.Parent.MouseClick:Connect(function(player) RE:FireClient(player) -- Fires the event to the client who clicked the clickdetector end)