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

Why does it say this line is a nil value?

Asked by 11 years ago
01function Money()
02    player = game.Players.LocalPlayer
03    money = player.leadstats.Money
04    bank = player.leaderstats.BankedMoney
05    withdraw = script.Parent.Parent.MoneyValue
06    money.Value = withdraw.Value+money.Value
07    bank.Value = withdraw.Value-bank.Value
08end
09 
10 
11script.Parent.MouseButton1Down:connect(Money)

It says that line 3 is a (Nil value)

which it's not...

0
"leadstats" misspelling I see. User#2 0 — 11y

3 answers

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

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

01function Money()
02    player = game.Players.LocalPlayer
03 
04    money = player.leadstats.Money --Here you have "leadstats"
05    bank = player.leaderstats.BankedMoney -- Here you have "leaderstats"
06 
07    withdraw = script.Parent.Parent.MoneyValue
08    money.Value = withdraw.Value+money.Value
09    bank.Value = withdraw.Value-bank.Value
10end
11 
12 
13script.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
11 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:

1money = player.leaderstats.Money
Log in to vote
-1
Answered by
Merely 2122 Moderation Voter Community Moderator
11 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. User#2 0 — 11y
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 — 11y

Answer this question