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

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

local PlrDetained = game.Players:FindFirstChild(PlrDetain)	
local Players = game:GetService("Players")
ClientRemote:FireClient(Players[PlrDetained]) -- invalid argument #2 (string expected, got nil)

5 comments

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

0

Are you sure is that where the error located?

0

It should be as it's "argument #2"

0

When you fire the client, the 1st argument should be the player.

0

All the answers really helped. Thanks. x

1 answer

✓ Accepted answer

Try doing this.

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

Tell me if it works or not

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