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

FireClient: player argument must be a Player object?

I don't get this, please help

-----------------------MY CODE-------------------------------------------------------------------------------------------

local RS = game:GetService("ReplicatedStorage")

local eventz = RS.RemoteEvents:WaitForChild("ForAdmin")

local plr = game.Players.LocalPlayer

eventz:FireClient(plr, "OWNERFRAMED",.852,0,.207,0)

The first argument is my gui's name, the second argument is for the numbers of using TweenPosition btw.

3 comments

0

you dont need to add a plr parameter for :FireClient()

0

FireClient is used to communicate from Server to Client. You cannot use LocalPlayer in a script so try using PlayerAdded.

0

Why are you using LocalPlayer in a Server Script

2 answers

✓ Accepted answer

Assuming you are using a Server Script , This is what you should be doing.

game.Players.PlayerAdded:Connect(function(plr)
local RS = game:GetService("ReplicatedStorage")

local eventz = RS.RemoteEvents:WaitForChild("ForAdmin")
-- You cannot use LocalPlayer in a server script
eventz:FireClient(plr)
end)

Also may you please elaborate on argument #2 (852,0,.207,0)

###FilteringEnabled

With FilteringEnabled being enabled, there are some mandatory restrictions. One of these applies to the script you're using, a Server Script. The change is that you cannot access LocalPlayer from the server. It will always return nil, which is why you are receieving. The player parameter you pass must be an Instance, instead it is nothing. nil. You will need another method of obtaining the player, such as the PlayerAdded event.

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