[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:
01 | Ok = BrickColor.new( "Lime green" ) |
02 | Ta = BrickColor.new( "Really red" ) |
07 | game.Players.PlayerAdded:Connect( function (Player) |
08 | if Player:GetRankInGroup(gid) > = gr then |
09 | Player.Chatted:Connect( function (msg) |
11 | for arg in string.gmatch(msg, "[^, ]+" ) do |
12 | table.insert(args, arg) |
14 | if args [ 1 ] = = "give" then |
15 | local TargetPlayer = args [ 2 ] |
16 | if TargetPlayer and game.Players [ TargetPlayer ] ~ = nil then |
17 | local plr = game.Players [ TargetPlayer ] |
19 | local RoomType = args [ 3 ] |
21 | if RoomType = = "room" then |
22 | local RoomNumber = args [ 4 ] |
25 | game.ServerStorage.RoomCards [ RoomNumber ] :Clone().Parent = game.Players [ TargetPlayer ] .PlayerGui |
26 | game.ReplicatedStorage.RoomDatabase.Standard [ RoomNumber ] .Owner.Value = TargetPlayer.Name |
27 | game.Workspace.Manage.SurfaceGui.Rooms [ RoomNumber ] .BackgrouncColor 3 = Ta |
28 | game.Workspace.Manage.SurfaceGui.Rooms [ RoomNumber ] .N 1. Text = TargetPlayer.Name |
30 | elseif RoomType = = "suite" then |
31 | local RoomNumber = args [ 4 ] |
34 | game.ServerStorage.SuiteCards [ RoomNumber ] :Clone().Parent = game.Players [ TargetPlayer ] .PlayerGui |
35 | game.ReplicatedStorage.RoomDatabase.Suites [ RoomNumber ] .Owner.Value = TargetPlayer.Name |
36 | game.Workspace.Manage.SurfaceGui.Rooms [ RoomNumber ] .BackgrouncColor 3 = Ta |
37 | game.Workspace.Manage.SurfaceGui.Rooms [ RoomNumber.. "S" ] .N 1. Text = TargetPlayer.Name |
If anybody has any ideas please let me know.