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

Argument 1 missing or nil?

So, I made another attempt at a Trello-API.

What I have tried to do is when you click the "Send" button, after you entered your group ID into the textBox it sends the group id and name..

Problems:

local id = script.Parent.Parent.TextFrame.TextBox

local group = game:GetService("GroupService"):GetGroupInfoAsync(tonumber(id.Text))

Full:

ap = require(script.Parent.Parent.Parent.TrelloAPI)  

local Board = ap:GetBoardID("Feedback")

local List = ap:GetListID("Recieved",Board)

local isOwner = false

local id = script.Parent.Parent.TextFrame.TextBox

local group = game:GetService("GroupService"):GetGroupInfoAsync(tonumber(id.Text))

local player = script.Parent.Parent.Parent.Parent.Parent

script.Parent.MouseButton1Down:connect(function()
	if player:IsInGroup(id.Text) and player:GetRankInGroup(id.Text) == 255 then
		isOwner = true
	else
		isOwner = false
	end
					--[Name],[Decription],[List ID]
	if isOwner == true then
		ap:AddCard("ID: "..id.Text.."; "..group.Name,"Sent by: "..game.Players.LocalPlayer.Name,List,"","top","","green")
	else
		ap:AddCard(id.Text,"Sent by: "..game.Players.LocalPlayer.Name,List,"","top","","red")
	end
	script.Parent.Parent.TextFrame.TextBox.Text = "Enter ID here..."
end)

23:27:31.685 - Argument 1 missing or nil 23:27:31.686 - Script 'Players.Player.PlayerGui.FeedbackGui.FeedBackFrame.Enter.Script', Line 11

1 answer

✓ Accepted answer

tonumber returns nil if the input has non-digit characters. Try using string.match instead to extract numbers from a string. string.match("asdf1234", "%d+") will return 1234 whereas tonumber("asdf1234") will return nil.

local group = game:GetService("GroupService"):GetGroupInfoAsync(string.match(id.Text, "%d+")) -- extracts the first series of numbers in a string.

To learn more about string functions and patterns in Lua, take a look at this and this.

2 comments

0

Literally nothing happens anymore :(

0

Try putting "group" inside the MouseButton1Down event.

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