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

Why does it say this line is a nil value?

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...

1 comment

0

"leadstats" misspelling I see.

3 answers

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.

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

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?

2 comments

0

Line 3 is the money value, and "leadstats" is misspelled. But I did look at Bank at first too.

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

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