I recently got this error
02:20:56.734 - Argument 1 missing or nil
02:20:56.735 - Script 'Players.Player.PlayerGui.Application.Frame.create.Script', Line 12
02:20:56.736 - Stack End
And I have no clue what It means. Can someone please explain and possibly tell me what I should do to line 12?
if plr:GetRankInGroup(tonumber(id)) == 255 then
Rest of script (Not sure if needed)
-- -- local create = script.Parent local frame = script.Parent.Parent local id = script.Parent.Parent.groupID.Text local plr = game.Players.LocalPlayer local ap = require(game.Workspace.TrelloAPI) create.MouseButton1Click:connect(function() if plr:GetRankInGroup(tonumber(id)) == 255 then --Line 12 wait() local group = game:GetService("GroupService"):GetGroupInfoAsync(tonumber(id.Text)) local BoardID = ap:GetBoardID("Appalachian Security Contract Application") local ListID = ap:GetListID("Applied",BoardID) local CardID = ap:AddCard("[NS] " .. group.Name, game.Players.LocalPlayer.Name, id, ListID) print("He's the owner!!!!") script.Parent.Parent.create.Visible = false wait(3) game.Players.LocalPlayer:Kick("Thank you for choosing Appalachian Private Security Company, we hope you choose us again! -APSC") else print("He's NOT the owner!!!!") script.Parent.Parent.Warn.Visible = true script.Parent.Parent.create.Visible = false script.Parent.Parent.groupID.Text = "Sorry, you MUST be the owner!" script.Parent.Parent.groupID.TextColor3 = script.Parent.Parent.groupID.TextColor3(255, 0, 0) wait(5) script.Parent.Parent.groupID.Text = "Enter group ID here" script.Parent.Parent.groupID.TextColor3 = script.Parent.Parent.groupID.TextColor3(0, 0, 0) end end)
Consider sanity checking your inputs.
local create = script.Parent local frame = script.Parent.Parent local id = script.Parent.Parent.groupID.Text local plr = game.Players.LocalPlayer local ap = require(game.Workspace.TrelloAPI) create.MouseButton1Click:connect(function() if tonumber(id) and plr:GetRankInGroup(tonumber(id)) == 255 then --Line 12 wait() local group = game:GetService("GroupService"):GetGroupInfoAsync(tonumber(id.Text)) local BoardID = ap:GetBoardID("Appalachian Security Contract Application") local ListID = ap:GetListID("Applied",BoardID) local CardID = ap:AddCard("[NS] " .. group.Name, game.Players.LocalPlayer.Name, id, ListID) print("He's the owner!!!!") script.Parent.Parent.create.Visible = false wait(3) game.Players.LocalPlayer:Kick("Thank you for choosing Appalachian Private Security Company, we hope you choose us again! -APSC") else print("He's NOT the owner!!!!") -- Or, the ID is invalid script.Parent.Parent.Warn.Visible = true script.Parent.Parent.create.Visible = false script.Parent.Parent.groupID.Text = "Sorry, you MUST be the owner!" script.Parent.Parent.groupID.TextColor3 = script.Parent.Parent.groupID.TextColor3(255, 0, 0) wait(5) script.Parent.Parent.groupID.Text = "Enter group ID here" script.Parent.Parent.groupID.TextColor3 = script.Parent.Parent.groupID.TextColor3(0, 0, 0) end end)
What's new?
On line 12, we now check to see if the input is actually in number form by seeing if tonumber()
returns a number or nil. If the input is not in a valid format, tonumber returns nil, which must be captured when handling user input.