Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

PlayerAdded Function help?

Asked by
Vividex 162
10 years ago

Im trying to make a script when a player is added, it changes the name of the player to #1 then #2 for next player to enter then #3 when next player enters and continues on. I know that you would probably use PlayerAdded function and new.Player, but I'm not sure how to make it give the player the number for the name then increase for the next player, help please?

2 answers

Log in to vote
0
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
10 years ago
local num = 1

Game.Players.PlayerAdded:connect(function(Player)
    local nm = num
    num = num + 1
    Player.CharacterAdded:connect(function(Char)
        wait() --So the character has time to load fully.
        Char.Name = "#" .. nm
    end)
end)

num in that script will increment by 1 for every Player than joins the game. It will not fill in numbers for Players leave, however, but the characters' names will persist through death.

It is (iirc) not possible to change the name of the Player objects, but you can change the name of the corresponding character Model.

0
I feel like it works some way but I wanted it to like make the number appear on top of the players head which does not happen with your script:-( Vividex 162 — 10y
0
This... does appear over their heads? I'm not sure exactly what it is you are looking for. adark 5487 — 10y
Ad
Log in to vote
-1
Answered by
hudzell 238 Moderation Voter
10 years ago

I just tried that, it is impossible. ROBLOX does not allow you to rename player names or character names.

Answer this question