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

invalid argument #2 (string expected, got nil) ?

Asked by 3 years ago
local PlrDetained = game.Players:FindFirstChild(PlrDetain)  
local Players = game:GetService("Players")
ClientRemote:FireClient(Players[PlrDetained]) -- invalid argument #2 (string expected, got nil)
0
This is weird because the arguments of :FireClient() is tuple(so it can be any types of value) https://developer.roblox.com/en-us/api-reference/function/RemoteEvent/FireClient Block_manvn 395 — 3y
0
Are you sure is that where the error located? Block_manvn 395 — 3y
0
It should be as it's "argument #2" Gokhaii 58 — 3y
0
When you fire the client, the 1st argument should be the player. Dovydas1118 1495 — 3y
0
All the answers really helped. Thanks. x TommyHArden 101 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

Try doing this.

local PlrDetained = game.Players:FindFirstChild(PlrDetain)  
local Players = game:GetService("Players")
ClientRemote:FireClient(PlrDetained)

Tell me if it works or not

Ad

Answer this question