What is the difference between ClassName and Name?

what is the difference between ClassName and Name? for example,

game.Workspace:FindFirstChild("bla bla")

vs

game.Workspace:FindFirstChildOfClass("bla bla")

Names are non-unique, ClassNames are unique. You can’t change the class name of an instance, but you can change its name. Say you need to get a part, but you don’t know the name of the part, you can find it by its class, then you would do :FindFirstChildOfClass("Part").

3 Likes

oh gotcha. so the ClassName for a player is Players? it says Players in the Explorer. i’m just wondering.

The ClassName for a Player is just Player. Players is the ClassName for the service that houses the Player instances.

1 Like

okay. if something is equiped would that make the class name character?

No, player characters are just Models in the Workspace.

1 Like

so if a player had something equipped what would the ancestor name be of the player that had that equipped part?

Nothing. The player and character are separate entities. The player is always found in the Players service. The player’s character is a Model found in the Workspace.

1 Like

so i’m saying for an example. someone had a key card to open a door. and when the player opens the door their name gets written on it. so in the script when you put

local owner of key card = key_card:FindFirstAncestorOfClass("bla bla")

what would you put as class name?

lol my bad the lua was messing up

The key card would probably be in their character as a tool.

local owner_of_key_card = player.Character:FindFirstChildOfClass("Tool")

though you should probably ask what you actually want to do rather than asking roundabout questions like this

1 Like

yeah so if i was doing FindFirstAncestorOfClass it wouldd be Character right

No, since Character is not a ClassName. Player’s Character points to a Model.

so what would the class name be? or in the scenario would you not use FindFirstAncestorOfClass?

It would just be model, but I am not sure what you are trying to do now. Please ask about your actual problem instead.

i explained the scenario. this is not my problem. someone else was having this issue and it interest me.

he has a keycard that players use to open a door and once the door is opened their name gets written on it. but sometimes backpack gets written on it instead. (and omg i realized that he probably has it set to if the card is in a players backpack they can still open the door and because he’s using key_card.Parent.Parent that happens).

we’re not talking about FindFirstChild anymore but instead FindFirstAncestor.

so what would the Ancestor Class Name of a player who has the tool equipped be.

im in the class section and see CharacterMesh is a class.

but he was having the issue that sometimes the name written on the wall would be just Backpack instead of the players name. so i thought of if he uses FindFirstAncestor. it would stop that. (but i just realized earlier on he needs to have it to where players can only open the door if they have the card equiped.)

The player instance is always in the Players service. When a player equips a tool the tool gets parented to the character, which is the model in the workspace. CharacterMesh is a class that applies mesh to body parts when you wear a package.

1 Like

oh okay. haha. but yeah Player ended up working