what im trying to do is making a regen script that takes away your money before it regens the part/model here is the script i made
location = script.Parent.Parent.Parent regen = script.Parent.Parent save = regen:clone() local price = 5 -- The price of your item. local db = true script.Parent.ClickDetector.MouseClick:connect(function(player) if player.leaderstats.Cash.Value >= price then player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - price db = false
function onClicked() regen:remove() local back = save:clone() back.Parent = location back:MakeJoints() db = true end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
it may be absolutely wrong but im also a beginner