i was trying to make a sell button and when i tried it it says:
"Workspace.Sell.Script:7: attempt to index nil with 'Value'"
here's the script for the sell:
script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
local leaderstats = player:findFirstChild("leaderstats")
local Cash = player:findFirstChild("Cash")
local Strength = player:findFirstChild("Strength")
if Strength.Value > 0 then
Cash.Value = Cash.Value + Strength.Value*1
Strength.Value = 0
end
end
end)

1 comment
the error was gone but the value of the cash doesnt change when the part was touched