I created a script that removes a value and replaces it for a different value here is the script:
01 | function Sell(hit) |
02 | local Sell = Instance.new( "IntValue" ) |
03 | local Quick = hit.Parent:FindFirstChild( "Ore" ) |
04 | local Quick 2 = hit.Parent:FindFirstChild( "Cash" ) |
05 | hit.Parent:FindFirstChild( "Ore" ).Sell.Value = Quick.Sell.Value - 1 |
06 | hit.Parnet:FindFirstChild( "Cash" ).Sell.Value = Quick 2. Sell.Value + 100 |
07 |
08 | end |
09 |
10 |
11 | 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.
01 | function Sell(hit) |
02 | local Sell = Instance.new( "IntValue" ) |
03 | local Quick = hit.Parent:FindFirstChild( "Ore" ) |
04 | local Quick 2 = hit.Parent:FindFirstChild( "Cash" ) |
05 | hit.Parent:FindFirstChild( "Ore" ).Sell.Value = Quick.Sell.Value - 1 |
06 | hit.Parent:FindFirstChild( "Cash" ).Sell.Value = Quick 2. Sell.Value + 100 -- you spelt parent wrong.. |
07 |
08 | end |
09 |
10 |
11 | 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.