Points not showing ingame

I 've created a point system thing , where they gain points until they fall into the lava , and then their points reset. It works perfectly in studio however once i publish to roblox it doesn’t show the points

I’ve tried looking for a solution on the Dev Forum and i have also tried finding something on Youtube , however i either haven’t found the right words for it , or i just can’t find anything on it.

This is the code :
local Players = game:GetService(“Players”)

local function onCharacterAdded(character, player)
player:SetAttribute(“IsAlive”, true)
local humanoid = character:WaitForChild(“Humanoid”)
humanoid.Died:Connect(function()
local points = player.leaderstats.Points
points.Value = 0
player:SetAttribute(“IsAlive”, false)
end)
end

local function onPlayerAdded(player)
local leaderstats = Instance.new(“Folder”)
leaderstats.Name = “leaderstats”
leaderstats.Parent = player

local points = Instance.new("IntValue")
points.Name = "Points"
points.Value = 0
points.Parent = leaderstats

player:SetAttribute("IsAlive", false)

player.CharacterAdded:Connect(function(character)
	onCharacterAdded(character, player)
end)

end

Players.PlayerAdded:Connect(onPlayerAdded)

while true do
wait(1)
local playerList = Players:GetPlayers()
for i = 1, #playerList do
local player = playerList[i]
if player:GetAttribute(“IsAlive”) then
local points = player.leaderstats.Points
points.Value = points.Value + 1
end
end
end

Do you have your code in a localscript rather than a server one?
I’m still partially confused about how localscripts work, but I think it could cause issues like this.