I tried to create a sell place but it is returning an error like this
This is the script
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.Coins
local Selling = leaderstats.Strength
if Selling.Value > 0 then
Currency.Value = Currency.Value + Selling.Value *1
Selling.Value = 0
script.Parent.Sound:Play()
end
end
end
end)
This is the script where I made the variable coins
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Model")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local money = Instance.new("IntValue")
money.Name = "Coins"
money.Value = 0
money.Parent = leaderstats
local Strength = Instance.new("IntValue")
Strength.Name = "Strength"
Strength.Value = 0
Strength.Parent = leaderstats
end)
As a debugging measure, you can check if Coins is even in the leaderstats folder by playtesting and at the top, clicking the client button to go into server. Then look in the explorer>Players>(your username)>leaderstats>Coins to make sure it’s there.