Ad
Log in to vote
0

Why does it say this line is a nil value?

Asked by 8 years ago
function Money()
    player = game.Players.LocalPlayer
    money = player.leadstats.Money
    bank = player.leaderstats.BankedMoney
    withdraw = script.Parent.Parent.MoneyValue
    money.Value = withdraw.Value+money.Value
    bank.Value = withdraw.Value-bank.Value
end


script.Parent.MouseButton1Down:connect(Money)

It says that line 3 is a (Nil value)

which it's not...

0
"leadstats" misspelling I see. Everesty 1006 — 8y

3 answers

Log in to vote
8
Answered by
Necrorave 560 Moderation Voter
8 years ago

Not really enough information to solve this entirely, but with what you have given I may see one mistake.

function Money()
    player = game.Players.LocalPlayer

    money = player.leadstats.Money --Here you have "leadstats"
    bank = player.leaderstats.BankedMoney -- Here you have "leaderstats"

    withdraw = script.Parent.Parent.MoneyValue
    money.Value = withdraw.Value+money.Value
    bank.Value = withdraw.Value-bank.Value
end


script.Parent.MouseButton1Down:connect(Money)


As I stated before, I do not think you provided enough info for use to help you effectively. Although, this is a basic observation I made looking at your script.

If this is incorrect, then I wish you luck later.

Ad
Log in to vote
1
Answered by
TheMyrco 375 Moderation Voter
8 years ago

EDIT: I didn't read the earlier answers properly, my bad. Necrowave got it.

I think it's because you misspelled "leaderstats":

money = player.leadstats.Money

So, replace with:

money = player.leaderstats.Money
Log in to vote
-1
Answered by
Merely 2122 Moderation Voter Community Moderator
8 years ago

The "BankedMoney" IntValue clearly doesn't exist. The question is why hasn't it been created yet? Which part of your script is responsible for creating the IntValues?

0
Line 3 is the money value, and "leadstats" is misspelled. But I did look at Bank at first too. Everesty 1006 — 8y
0
Ok fixed that but now it's making the BankedValue Negative when i click Withdraw instead of adding money to the Money not in the Bank DeveloperAtWork 14 — 8y

Answer this question