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

[SOLVED] Line 29: bad argument #3 to Value (string expected, got nil) in my script, what's going on?

Asked by 6 years ago
Edited 6 years ago

I am trying to make a room give script where you say 'give PLAYER room NUMBER' and it keeps saying this, Line 29: bad argument #3 to Value (string expected, got nil)

Here's the script:

01Ok = BrickColor.new("Lime green")
02Ta = BrickColor.new("Really red")
03 
04gid = 4548562
05gr = 7
06 
07game.Players.PlayerAdded:Connect(function(Player)
08    if Player:GetRankInGroup(gid) >= gr then
09        Player.Chatted:Connect(function(msg)
10            local args = {}
11            for arg in string.gmatch(msg, "[^, ]+") do
12                table.insert(args, arg)
13            end
14            if args[1] == "give" then
15                local TargetPlayer = args[2]
View all 46 lines...

If anybody has any ideas please let me know.

0
use lua brackets DinozCreates 1070 — 6y
0
how? BenjySmb 16 — 6y
0
edit your question, click the blue Lua button then the 2 rows of squigglies need to surround the code DinozCreates 1070 — 6y
0
Edi:- code block. User#5423 17 — 6y
View all comments (3 more)
0
Done BenjySmb 16 — 6y
0
which line is 29? its just an end here DinozCreates 1070 — 6y
0
also why arent you using locals? there are a lot of situations here where you could combine if statements for a lot more efficiency, and more importantly to clean this nasty code up. DinozCreates 1070 — 6y

Answer this question