I want the following script which is attached to a button on a vending machine to charge the player X amount of cash (cash is my in game currency in (leaderstats) and deduct that amount from the player. Any help on this would be greatly appreciated.
function onClicked()
local Bloxy = game.Lighting.DrinkandFood.DMLEnergy:clone()
Bloxy.Parent = game.Workspace
Bloxy.Handle.Position = script.Parent.Parent.HolderD.Position
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

1 comment
I appreciate the response. Ive tried a few variations and still cant get it. Looking for someone to show me.