So I have this code that client sided, that gives you a money tool depending on the money you put it, but I need it give the money value to the money tool, server sided, but im confused on how i would split this up, any help? Here is the script.
local currency = "Cash" -- Change this to the currency you want to use local button = script.Parent local setter = button.Parent.AmountBox debounce = false function chaching() button.Image = "http://www.roblox.com/asset/?id=96539788" wait(1) button.Image = "http://www.roblox.com/asset/?id=96539352" end function errormessage() setter.ErrorText1.Visible = true wait(3) setter.ErrorText1.Visible = false end function notenough() setter.ErrorText2.Visible = true wait(3) setter.ErrorText2.Visible = false end function onClick() if debounce == false then local player = button.Parent.Parent.Parent.Parent if tonumber(setter.Text) and tonumber(setter.Text) % 1 == 0 and tonumber(setter.Text) >= 1 then local amount = setter.Text local cash = player.leaderstats:FindFirstChild(currency) if tonumber(amount) <= cash.Value or tonumber(amount) == cash.Value then cash.Value = cash.Value - tonumber(amount) wait() player.leaderstats.Cash.Value = player.leaderstats.Cash.Value local bag = game.Lighting.Money:clone() bag.Parent = player:FindFirstChild("Backpack") bag.MoneyValue.Value = amount debounce = true spawn(chaching) wait(5) debounce = false else notenough() end else errormessage() end end end button.MouseButton1Click:connect(onClick)