Is there anything above this script?
I recommend replacing the game.Players.PlayerAdded connection with
local function onPlayerAdded(plr)
Then, below this event, add this:
for _, plr in ipairs(game.Players:GetPlayers()) do
coroutine.wrap(onPlayerAdded)(plr)
end
game.Players.PlayerAdded:Connect(onPlayerAdded)
Even if the issue turns out to be something else, this is the best way to do so, as if you were to have to require for example a module via assetId, this will take care of the player’s who joined while the module was loading.
No problem, happens to the best of us. Make sure to look out for any red underlines in your code, or else there will always be an error.
Thought I’d also add that you can condense the code when using Instance.new. The second parameter inside of it will actually specify the new instance’s parent. For example,
local attr = Instance.new(“Folder”, player)
attr.Name = “Attributes”
local health = Instance.new("IntValue", attr)
health.Name = "Health"