Im trying to make a gui that will go invisible but only for you so I used remove events but its not working
(I already have variables) close:FireClient(main) - Server Script that activates from a local
Then in a local script
local gui = script.Parent
local close = gui.Close
close.OnClientEvent:Connect(function(player,main)
game.StarterGui.CharacterSelectionGUI.Frame.Visible =
print(“UMM”)
end)
But i’m also getting the error “FireClient: player argument must be a Player object”
1 Like
Quick tip next time use ``` to make code sections to make your code easier to read
Well to start with your error suggests exactly what it says, in your server script the part where you have:
close:FireClient(main)
the first argument (your main
variable) need to be something like
game.Players.Flaming_Lion75
not a string which you may have put
Second is that the OnClientEvent does not have a player argument as its first argument. It would just be:
close.OnClientEvent:Connect(function(main)
end)
And FINAL thing is that to set the players current GUI to non visible or visible you need to use playerGUI. For example:
-- Instead of using this:
game.StarterGui.CharacterSelectionGUI.Frame.Visible = false
-- Use this instead:
game.Players.LocalPlayer.PlayerGui.CharacterSelectionGUI.Frame.Visible = false
If you’re trying to make a GUI only go invisible for a singular player, you do not need remote events.
If you use a LocalScript and set the visible property to false through that local script, it would already be invisible just for the player.
4 Likes
listen to this guy, he is true
make sure that “main” is a player. not a character or anything else. Get back to me if its one and if its not then you should put it.
Some things cannot run in a localscript. But if your just trying to make something become visible and whatever your doing is compatible with localscripts then I agree you should simply just use one 