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!
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)