I am making a game where you can sell blocks but I have an error here. The stored value does not add to the money when you stand on the sell pad to sell the stored value. I have been trying to solve the problem but it doesn't work. Any help will be appreciated!
Here's the script:
local sell = script.Parent
local Player = game.Players.PlayerAdded:Wait(20)
local leader = Player:WaitForChild("leaderstats")
local Money = leader:WaitForChild("Money")
local Stored = leader:WaitForChild("Stored")
sell.Touched:Connect(function(sellblock)
local sellable = sellblock:FindFirstChild("CanSell")
if sellable then
Money.Value = Money.Value + 100
sellblock:Destroy()
end
end)
sell.Touched:Connect(function(storeblock)
local humanoid = storeblock:FindFirstChild("Humanoid")
if humanoid then
Money.Value = Money.Value + Stored.Value * 100
Stored.Value = 0
end
end)
