Im trying to add points to an intvalue of a killer after player dies.... I have leaderboard and added the code i am unsure about...
------------Original LeaderBoard function Entered(player) wait() if player:findFirstChild("leaderstats") ~= nil then player.leaderstats:remove() end stats = Instance.new("IntValue") stats.Parent = player stats.Name = "leaderstats" points = Instance.new("IntValue") points.Parent = stats points.Name = "Points" points.Value = 0 --How much you start out-- end game.Players.PlayerAdded:connect(Entered) c = game.Players:GetChildren() for i=1, #c do Entered(c[i]) end --------------------------works, i think based on test function getKillerOfHumanoidIfStillInGame(humanoid) tag = humanoid:findFirstChild("creator") if tag ~= nil then killer = tag.Value if killer.Parent ~= nil then return killer end end return nil end ---------------------------------------------does absolutely nothing idk why game.Players.PlayerAdded:connect(getKillerOfHumanoidIfStillInGame) for i=1, #c do if (getKillerOfHumanoidIfStillInGame(c[i])) then killer.points.Value = killer.points.Value+5
You can test it with studio.
Go Test and select 2 or 3 players (to make sure), press start server and you will play with 3 players at same time. You can also do it for SP sometimes studio load faster that a normal server.
AND REMEMBER THE WAITFORCHILD! You can do :WaitForChild, While not, until etc.