That’s going to find the first model in the game, not specifically the player? And even if it finds a player, it won’t be a specific one, it will be the first one it finds.
You can access the player from the workspace. You just have to have a way to either loop through all of them or uniquely find a player. Usually if you have to find the character from workspace you are probably doing something wrong.
Like I could do game.Workspace.tlr22 to get my own character (assuming I’ve already spawned). But if I search for the first model I might get my friends model, or I might get the model that is a building.
My question is how do you know what character you are trying to find? The answer to that will be how you learn to search for it.
task.wait(2)
local workspaceParts = game.Workspace:GetDescendants()--[[So we can loop through the workspace later]]
local playerTable = {}
local players = game:GetService("Players")
players.PlayerAdded:Connect(function() do --[[Every time a player joins it executes code]]
task.wait(5)--[[To let the player load in]]
for i, v in pairs(workspaceParts) do
if v:IsA("BasePart") and v.Name == "HumanoidRootPart" and v.Parent ~= game.Workspace.Noob --[[Or just any npc you want to ignore]] then
local playerName = v.Parent.Name
table.insert(playerTable, playerName)
end
end
end
end)
But like, I don’t get why you’d even want to do this, PlayerAdded gives the player that was added as information, which you can use to access any parts you need, humanoid, humanoidrootparts, there are a ton of better ways to do this, also this may not work i didn’t test it.