Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 8 years ago
Edited 8 years ago

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

Log in to vote
0
Answered by 8 years ago

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

Answer this question