Getting error not sure why

I keep getting this error I’m not sure why Money is a number value inside of workspace.cash here is the code

local clickDetector = workspace.Cash.ClickDetector
local cash = workspace.Cash

function onMouseClick()
	cash.Money.Value = cash.Money.Value + 1
	print(cash.Money.Value)
end

clickDetector.MouseClick:Connect(onMouseClick)

This is the error I’m getting “Money is not a valid memeber of Part"Workspace.Cash”"

1 Like

Can you send a screenshot of your explorer?

1 Like

Idk how on this computer but its just a part with a click detector and a number value called money

1 Like

Have you tried using WaitForChild?

local clickDetector = workspace.Cash.ClickDetector
local cash = workspace.Cash

function onMouseClick()
	cash:WaitForChild("Money").Value = cash.Money.Value + 1
	print(cash.Money.Value)
end

clickDetector.MouseClick:Connect(onMouseClick)
1 Like

Check that your NumberValue is actually called “Money”, case-sensitive (capital M).

1 Like

Didn’t work still says the same thing

1 Like

Yes I’m sure I did first thing I checked

1 Like

Could you send a screenshot of your studio so we can see the Explorer?
Press the Print Screen button on your keyboard, then copy and paste into the message thing here.

1 Like

FYI using :WaitForChild() on the server is considered bad practice generally speaking, and should never be necessary except for a tiny minority of use cases.

(assuming OP is using a server Script)

1 Like

I got the screenshot but idk how to upload it to the dev forum

1 Like

Press Ctrl + V in the message box that pops up when you type a message.

1 Like

1 Like

my bad u cant see whats inside the part

2 Likes

Just click on the little arrow next to Cash, then send the screenshot again :slight_smile:

How very strange, that looks fine to me? Are you sure there are no other scripts that may be deleting Money from the part?

In the script inside cash can you try

local cash = script.Parent
local clickDetector = cash.ClickDetector

function onMouseClick()
	cash.Money.Value += 1
	print(cash.Money.Value)
end

clickDetector.MouseClick:Connect(onMouseClick)

try printing cash.Money and tell me the output

I’m pretty sure there aren’t any other scripts deleting it

it says money so idk if thats the problem or what