Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why does this not work?

I have tried shifting things around but it does still not work.

Thanks for people helping me in advance to anybody that does.

-- Function for adding players
function playerAdded(player)
	player.TeamColor = BrickColor.new(1)
	local leaderstats = Instance.new("Model")
	leaderstats.Name = 'leaderstats'
	
	local points = Instance.new("IntValue")
	points.Name = "Ch-Ching"
	points.Parent = leaderstats
	
	leaderstats.Parent = player
	
	player.CharacterAdded:connect(function(character)
		newcharacter(player, character)
	end)
	if player.Character and player.Character.Parent then
		newcharacter(player, player.Character)
		
	end
		
	
	
	
	
end
-- Event for handling that function
game.Players.PlayerAdded:connect(playerAdded)
for _, player in pairs(game.Players:GetPlayers()) do
	playerAdded(player)

1 answer

-- just a little example
-- by test1097

game.Players.PlayerAdded:connect(function(player)
	local leaderstats = Instance.new("Model")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player
	local points = Instance.new("IntValue")
	points.Name = "points"
	points.Parent = leaderstats
end)

while wait(3) do
	for _, player in pairs (game.Players:GetChildren())do
		player.leaderstats.points.Value = player.leaderstats.points.Value +1
	end
end

This discussion is preserved as it was. New answers, comments, and votes are closed.