Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Leaderboard sell brick script?

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.

2 comments

0

Are you trying to make it so if a player touches it?

0

line 6 you spelled 'parent' wrong

2 answers

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.