Hello! I've been very confused of this :FireClient(). I've tryed it myself, and this is the code:
script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then game.ReplicatedStorage.ShowCodeGUI:FireClient() end end)
After running and testing, I've got this error:
Argument 1 missing or nil
Need explanations please! Thank you.
You need to inser player in the FireClient(), so please replace your script to this:
game.Players.PlayerAdded:Connect(function(player) script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then game.ReplicatedStorage.ShowCodeGUI:FireClient(player) end end) end)
This should work.
Like the other comment by Gabe, You have to specify a player. It says "argument one missing" because the argument one should be the player your trying to send an input to!
This doesn't apply to :FireAllClients(), arguments are not necessary since it sends the fire info to each person.
Also, for something to happen when you fire the client, you have to add a .OnClientEvent function (heres an example:)
local remote = game.ReplicatedStorage.ShowCodeGUI remote.OnClientEvent:Connect(function(arguments from server) print('client has been fired!!') end)
obviously you'd change "arguments from server" and the code inside the function, but you should get the idea.