Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

FireClient: player argument must be a Player object?

Asked by 5 years ago
Edited 5 years ago

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.

0
you dont need to add a plr parameter for :FireClient() User#23365 30 — 5y
0
FireClient is used to communicate from Server to Client. You cannot use LocalPlayer in a script so try using PlayerAdded. xPolarium 1388 — 5y
0
Why are you using LocalPlayer in a Server Script wentman 19 — 5y

2 answers

Log in to vote
0
Answered by
wentman 19
5 years ago
Edited 5 years ago

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)

Ad
Log in to vote
1
Answered by
green271 635 Moderation Voter
5 years ago

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.

Answer this question