What is difference between player in Players and player in Workspace

As title says, what is difference between both and how to make path to those?

Difference between player in Players and player in Workspace

In Roblox Studio, Players is a service that contains all players currently playing the game. Each player object represents a user account and contains properties such as Name and UserId . On the other hand, Workspace is a service that contains all objects that are part of the game world. When a player joins a game, their character model is added to Workspace .

Here’s an example script that demonstrates how to access a player object from both services:

local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")

-- Accessing a player object from Players
local playerName = "Player1"
local playerFromPlayers = Players:FindFirstChild(playerName)

-- Accessing a character model from Workspace
local characterFromWorkspace = Workspace:FindFirstChild(playerName)

It’s important to note that while both objects represent the same user account, they serve different purposes. The player object contains information about the user account while the character model represents their avatar in-game.

1 Like

A player in workspace is their character, while a Player in Players containers their information (DisplayName, UserId, etc).

You can get a Player’s character by referring to the Character property in their Player Instance in Players.

-- getting a player from the client
local localPlayer = game:GetService("Players").LocalPlayer
local localCharacter = localPlayer.Character or localPlayer.CharacterAdded:Wait()


1 Like

Thank you


Thank you too


Adding to this, how do you refer to a local player, not a single one?

1 Like

You can refer to the local player using the LocalPlayer property of the Players service. Here’s an example:

local Players = game:GetService("Players")
local localPlayer = Players.LocalPlayer

This will return the player object for the user running the script. Keep in mind that this only works in a LocalScript or a ModuleScript that is used by a LocalScript.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.