Is the player inaccessible in a workspace other than game.player?
for example
local user = workspace:FindFirstChildOfClass(“Model”)
Is the player inaccessible in a workspace other than game.player?
for example
local user = workspace:FindFirstChildOfClass(“Model”)
I don’t really get what you mean, if you want to get the player using a local script, you can do it like this:
local Player = game:GetService("Players").LocalPlayer
but for the server you would have to connect a PlayerAdded
event.
local Player = game.Players.PlayerAdded:Wait()
or
game.Players.PlayerAdded:Connect(function(player)
-- do stuff when player joins
end)
now, from here, you can get the Players Character, PlayerGui, Humanoid, e.t.c, something like this:
local Player = game.Players.LocalPlayer--Player
local Character = Player.Character or Player.CharacterAdded:Wait()--Character
Please, elaborate further, as I do not understand what you mean by "Is the player inaccessible in a workspace other than game.player?’
What you referred to there was the Character of a user
local Player = game:GetService("Players").LocalPlayer -- gets the player
local Character = Player.Character or Player:CharacterAdded:Wait() -- gets the character with the "model" class as you were trying to get
Players in the workspace with humanoid
I understand that it’s different to be located in Game.Player
I want access to a player whose class name is a model underneath the workspace, but it’s not working
Game.Player is not a thing in studio, you first have to require the Players Service, where all the players/clients are located, and from there, get the players character like I stated in the example of my other post.
You won’t find a player under workspace, you will find them in the Players Service, you can use Player.Character
to get the character, but the character is always going to be a model, so no need to check the class name. And the Character is always going to parented to workspace, at least, a playable character will be. So, I still don’t understand what you want, just access the character??
what are you trying to do here?
get every single player’s character model?
get a single player’s character?
you need to give more information
Nope, but it could happen that the player has a strange name and you confuse the player with another object, or the player not having a character for a few seconds when reset.
There is also GetPlayerFromCharacter, which is returned by the player according to their character in case you want to do a Touched
event.