Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Leaderboard sell brick script?

Asked by 9 years ago

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.

0
Are you trying to make it so if a player touches it? ObscureEntity 294 — 9y
0
line 6 you spelled 'parent' wrong YellowoTide 1992 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago
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)

Ad
Log in to vote
0
Answered by 9 years ago

-- 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.

Answer this question