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

Why does Argument 1 missing or nil keeps coming when I execute my dialog?

I made this really small code for part of a dialog response

function gj1(gj1)
		game.Players:FindFirstChild().leaderstats.Money = 50
end

game.Workspace.Part.Dialog.DialogChoiceSelected:connect(gj1)

However when ever I execute it I get this error code Argument 1 missing or nil I have tried to find what it means but it's all too vague if someone could explain to me what it means and how to fix it that will be great!

1 answer

✓ Accepted answer

The problem is that FindFirstChild is supposed to take an argument, but you're not passing it anything. It is supposed to take a string which is the name of the child to find. But from what I can tell, it's probably not what you need. If you want to find the player, DialogChoiceSelected will provide you with that.
I'm also assuming Money is some sort of value object, in which case you must use the Value property:

function gj1(player)
	player.leaderstats.Money.Value = 50
end

game.Workspace.Part.Dialog.DialogChoiceSelected:connect(gj1)

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