I'm making a script to make a "bank" so that the contents of an intvalue inside a player's backpack can be stored inside an intvalue inside a brick. The actual script that makes this happen in inside a textbutton, so the structure of the whole thing is like
bankbox |-Gui Frame |-Depositamt (a textbox) |- Depositbutton (a button) |- script player |- Backpack |-Money (intvalue)
The code is below
function OnMouseClick() local player = script.Parent.Parent.Parent.Parent.Parent local playeracct = script.Parent.Parent.Parent:FindFirstChild(player.Name) if playeracct == nil then playeracct = Instance.new("IntValue") playeracct.Parent = script.Parent.Parent.Parent playeracct.Name = player.Name playeracct.Value = 0 end playeracct.Value = playeracct.Value + tonumber(script.Parent.Parent.Depositamt.Text) player.Backpack.Monies.Value = player.Backpack.Monies.Value - tonumber(script.Parent.Parent.Depositamt.Text) end script.Parent.MouseButton1Click:connect(OnMouseClick)
When I test this script, it doesn't have any errors that display on the console, but nothing happens to my "money" intvalue in my player. I'm at a loss on how to explain that, and would appreciate another person's opinion.