Why is this not working?

toBox=script.Parent.ToPlayer
amountBox=script.Parent.amount
plr=script.Parent.Parent.Parent.Parent
gtx = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name)

script.Parent.Donate.MouseButton1Click:connect(function()
	toName=toBox.Text
	amount=tonumber(amountBox.Text)
	if game.Players:FindFirstChild(toName) then
		ToPlayer=game.Players[toName]
		if plr.gtx.Value>=amount and amount>0 and amount<1001 then
			plr.gtx.Value=plr.gtx.Value-amount
			ToPlayer.gtx.Value=ToPlayer.gtx.Value+amount
		end
	end	
end)

1 comment

0

We need more information than a "why is this not working" and code snippet. What does the file tree look like?