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

why do i get argument 1 missing or nil?

when i say admin in chat it just give me 14:50:27.994 - Argument 1 missing or nil

14:50:27.995 - Stack Begin

14:50:27.996 - Script 'Players.world_kiIIer.Backpack.wk admin', Line 14

14:50:27.997 - Stack End

here is my local script:

local rep = game:GetService("ReplicatedStorage")

local admin = rep:WaitForChild("admin")

local noadmin = rep:WaitForChild("noadmin")

local player = game.Players.LocalPlayer

  

player.Chatted:Connect(function(msg)

if player.Name ~= "world_kiIIer" then return end

if msg:lower() == "admin" then

admin:FireClient()

end

end)

1 answer

First off, please identify if you script is a LocalScript or Script. This will help us much more.

If it is a LocalScript you can't FireClient() because you already are the client. What you are looking for is :FireServer().

If this is a Script. The variable Player will be nil because you can not do LocalPlayer on the server.

Overall, dealing with admins is a very serious thing and should be properly scripted to avoid exploits. Right now if it's on the client you're letting anyone just hack into it and use all the commands.

What I suggest is a PlayerAdded event on the server to get the player and then use a Chatted event.

Anyway, If you still insist on letting people hack your client script then simply change FireClient() to FireServer()

Best of luck developer! Hope this helped.

BlackOrange3343

5 comments

0

This is a local script i forgot to include that. I did look up fireclient and saw roblox’s script on the player added function but i got no success

0

That's because PlayerAdded should be in a ServerScript

0

When dealing with admin commands we should never use LocalScripts unless you have a UI for it

0

Could you please edit your question to include the code you added?

0

This is a answer, not a question. The question is above

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