I wanted to create cash per kill but for some reason I encounter an error (shown below)
I worked with the following script:
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new(“Folder”)
leaderstats.Name = “leaderstats”
leaderstats.Parent = playerlocal cash = Instance.new("NumberValue") cash.Name = "Cash" cash.Parent = leaderstats player.CharacterAdded:Connect(function(Chr) Chr.Humanoid.Died:Connect(function(Died) local creator = Chr.Humanoid:FindFirstChild("creator") local leaderstats = creator.Value:FindFirstChild("leaderstats") if creator ~= nil and creator.Value ~= nil then leaderstats.Cash.Value = leaderstats.Cash.Value + 10 end end) end)
end)
There is an error "Attempt to index nil with “Value”
Who knows what to do?