1

# How to Get a Character From a Player()?

manith513 101
2 years ago

Hello guys so I am sure a lot of you know the way GetPlayerFromCharacter() works its when you usually use an event that triggers the player's body in workspace and gets their player form in the players category I want to do the opposite I want to get the character from player and I don't really know how to do that here is my script so far

game.Players.PlayerAdded:Connect(function(player)
local bob = player:GetCharacterFromPlayer()

local it = Instance.new("Part",bob.HumanoidRootPart)
end)

0
player.Character is the character you want Leamir 3138 — 2y

1
Nckripted 580
2 years ago

Get the character like this:

local char = workspace:FindFirstChild(player.Name)


Hope this helped.

0
This can lead to erros, lets say that a player called "Part" joins, it may select any part called "Part" on his workspace Leamir 3138 — 2y
0
mmmm that would be true but the thing is that is impossible right as a roblox user needs to be a certain length? manith513 101 — 2y
0
I looked it up and there is indeed a person named part but that user hasn't been online since 2 years soooo manith513 101 — 2y
0
You could use tostring and prevent that from happening. Nckripted 580 — 2y
0
You could use tostring and prevent that from happening. Nckripted 580 — 2y
0
You could use tostring and prevent that from happening. Nckripted 580 — 2y
1
Benbebop 1049
2 years ago
Edited 2 years ago

In the future please add punctuation so we can understand faster and diagnose the problem with more accuracy.

Anyway here you go, its player.Character

Here is how it works.

game.Players.PlayerAdded:Connect(function(player)
local bob = player.Character

local it = Instance.new("Part",bob.HumanoidRootPart)
end)


Its simply an attribute that links directly to the Character.

0
ah thank you I didn't see this I should have accepted your answer as it is much clearer manith513 101 — 2y