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

What is wrong with this?

tab={"tumadrina","Person","People","etc"}
game.Players.PlayerAdded:connect(function(plr)
    stats = Instance.new("IntValue",plr) 
    stats.Name = "leaderstats"
 
    points = Instance.new("IntValue",stats)
    points.Name = "Points" 
    points.Value = 0 
end) 
game.Players.PlayerAdded:connect(function()
	for i,v in pairs(tab)do
		if game.Players.PlayerAdded==v then
			game.Players.PlayerAdded.Points.Value=9
		end
	end
end)

nothing in the output and the problem is I don't have 9 points

1 answer

✓ Accepted answer

You don't need two event handlers, and you're accessing an event (on line 13) and treating it like it's a player. Do this:

tab={"tumadrina","Person","People","etc"}
game.Players.PlayerAdded:connect(function(plr)
    stats = Instance.new("IntValue",plr) 
    stats.Name = "leaderstats"

    points = Instance.new("IntValue",stats)
    points.Name = "Points" 
    points.Value = 0 
    for i,v in pairs(tab)do
        if game.Players.PlayerAdded==v then
            plr.leaderstats.Points.Value = 9
        end
    end
end)


1 comment

0

Thanks

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