Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What is a player object?

There was an error when I wanted to pass getchildren in fireclient, and it said "FireClient: Player argument must be a player object". I changed the data to just Score which was in player (which I already declared via other remote events) because I thought since it was a descendant from player it would be considered a player object. WRONG. What do I do?

1 comment

0

A player object is the player themselves.

1 answer

The way you can solve this is in the following code:

--Script

local remoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent")

game.Players.PlayerAdded:Connect(function(player) --this parameter is the player object
    remoteEvent:FireClient(player)
end)

-- ==========================================
--LocalScript
local remoteEvent = game.ReplicatedStorage.RemoteEvent
local player = game.Players.LocalPlayer

remoteEvent.OnClientEvent:Connect(function()
    --YourCode
end)

If this works for you, make this the solution.

This discussion is preserved as it was. New answers, comments, and votes are closed.