I created a script that removes a value and replaces it for a different value here is the script:
function Sell(hit) local Sell = Instance.new("IntValue") local Quick = hit.Parent:FindFirstChild("Ore") local Quick2 = hit.Parent:FindFirstChild("Cash") hit.Parent:FindFirstChild("Ore").Sell.Value = Quick.Sell.Value - 1 hit.Parnet:FindFirstChild("Cash").Sell.Value = Quick2.Sell.Value + 100 end script.Parent.Touched:connect(Sell)
I don't know what is wrong with it. If there is something I could add on to make it so it doesn't have a chance of exploits. Please point out why this isn't working. Thank you. Already tried: hit.Parent:FindFirstChild("leaderstats") as a string to connect to the values. That's it.
function Sell(hit) local Sell = Instance.new("IntValue") local Quick = hit.Parent:FindFirstChild("Ore") local Quick2 = hit.Parent:FindFirstChild("Cash") hit.Parent:FindFirstChild("Ore").Sell.Value = Quick.Sell.Value - 1 hit.Parent:FindFirstChild("Cash").Sell.Value = Quick2.Sell.Value + 100 -- you spelt parent wrong.. end script.Parent.Touched:connect(Sell)
-- I figured it out. Buuutt, I added a inner string that makes it so if you don't have ore you can't sell. But -- it didn't work so I could go -1 and exc ore while collecting more cash.