Because when you get the head of your player (im not sure with this) you would do
game.Workspace.username.Head
But I want it so that you can get the head of every player since the code is just set to your own nickname. I want it so that you can get the head of everyone in the server.
Three things.
1. You can get the head of every player by simply looping through the player list using a for loop. When doing this however, make sure to check for their characters, as well as their heads, as if a player had died, or even had his head removed, it can cause an error when attempting to get the player's head. Here's a quick example.
for i,v in pairs(game.Players:GetChildren()) do --If you've changed the Players object's name in the game, make sure to use game:GetService("Players"):GetChildren(). It also may ever so slightly run faster. if v.Character and v.Character:FindFirstChild("Head") then --A simple nil test, checks whether the character and head exists to prevent errors. v:Destroy() -- Removes the player's head, simply an example. v is the head object in this loop. end
2. From your request, I'm assuming that getting the heads of every player is how you plan on accomplishing the goal of getting nicknames. Currently, I'm under the assumption that one would set their nickname based on the input from a gui object, such as a text box. Now, I'm certain one can use a loop like the one above to accomplish the task, but I would personally suggest simply using a remote function or remote event(based on the nature of the request, I'm also assuming a remote event would be used) to add a billboard gui or just set the text of it to the proposed name.
3. Just a friendly reminder that since these are nicknames, players can very well put some "no no words" as their nicknames, which may result in Roblox putting the game you're making under review. If you plan on using nicknames in your game, make sure to add text filtering to the game in order to ensure this doesn't happen to you.
The player's model is in the workspace so you can access it easily by this simple line of code.
(EDITED)
for i,v in pairs(game.Players:GetChildren()) do if v.Character and v.Character:FindFirstChild("Head") then {CODE} end