Why doesn't this work?
Error: Workspace.SellPlace.SellPart.Script:10: attempt to compare number with string
local Part = script.Parent Part.Touched:Connect(function(HIT) local H = HIT.Parent:FindFirstChild("Humanoid") if H then local player = game.Players:GetPlayerFromCharacter(HIT.Parent) if player then local leaderstats = player:WaitForChild("leaderstats") local Currency = leaderstats.Money local Selling = leaderstats.Strength if Selling.Value > 0 then Currency.Value = Currency.Value + Selling.Value *1 Selling.Value = 0 end end end end)
It seems like you made your strength value as a StringValue instead of IntValue. I also spotted a little mistake:
local Part = script.Parent Part.Touched:Connect(function(HIT) local H = HIT.Parent:FindFirstChild("Humanoid") if H then local player = game.Players:GetPlayerFromCharacter(HIT.Parent.Name) -- You said HIT.Parent if player then local leaderstats = player:WaitForChild("leaderstats") local Currency = leaderstats.Money local Selling = leaderstats.Strength if Selling.Value > 0 then Currency.Value = Currency.Value + Selling.Value *1 Selling.Value = 0 end end end end)
If this helped please thumbs up and accept this answer.
All the best,
PrismaticFruits