Properties
.Parent
The direct parent of the object in the hierarchy. Setting this property to a new Instance
will move the object. Setting it to nil
will remove it from the game world.
local part = game.Workspace.MyPart
print("The parent of MyPart is", part.Parent.Name) -- "Workspace"
-- Move the part to be a child of the character
part.Parent = game.LocalPlayer.Character
.Name
The name of the object.
local part = game.Workspace:FindFirstChild("Baseplate")
print(part.Name) -- "Baseplate"
part.Name = "NewBaseplate"
.Character
The character model currently controlled by the Player
. This model contains the Humanoid
and all body parts. This can be nil
if the player has not spawned yet or their character has been destroyed.
local character = game.LocalPlayer.Character
if character then
-- Character exists, find the Humanoid
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
print("My health is:", humanoid.Health)
end
end
.ClassName
The specific class type of the object (e.g., "Part", "Humanoid", "Player").
for _, child in ipairs(game.Workspace:GetChildren()) do
print(child.Name, "is a", child.ClassName)
end
.Address
The memory address of the object instance, represented as a hexadecimal string. Useful for a unique identifier.
print("Workspace address:", game.Workspace.Address)
.Color
The RGB color of the Part, represented as a Color3 object.
local myPart = game.GetWorkspace().MyPart
-- Set the color to pure blue
myPart.Color = Color3.new(0, 0, 255)
-- Read the color back and check its components
local currentColor = myPart.Color
print("The red component is: " .. currentColor.R)
.Material
The name of the physical material of the object (e.g., "Plastic", "Metal", "Neon").
game.Workspace.MyPart.Material = "Neon"
.Size
The size of the Part's bounding box along its local X, Y, and Z axes, represented as a Vector3.
local myPart = game.GetWorkspace().MyPart
-- Make the part a 10x10x10 cube
myPart.Size = Vector3.new(10, 10, 10)
-- Read the size back
local currentSize = myPart.Size
print("The part's width (X size) is: " .. currentSize.X)
.Value
A generic property for getting or setting the value of "Value Objects" like StringValue, NumberValue, ObjectValue, etc. The type returned or accepted depends on the object's ClassName.
local myStringValue = game.Workspace.MyStringValue
print(myStringValue.Value) -- "Hello"
myStringValue.Value = "New Value"
local myObjectValue = game.Workspace.MyObjectValue
myObjectValue.Value = game.LocalPlayer.Character -- Set it to an Instance
.SoundId
The asset ID of the sound associated with this object, if any.
.Position
The 3D world coordinate of the Part's center, represented as a Vector3 object.
local myPart = game.GetWorkspace().MyPart
-- Get the position as a single Vector3 object
local currentPos = myPart.Position
print("The part's height (Y position) is: " .. currentPos.Y)
-- To set the position, you must create a new Vector3
myPart.Position = Vector3.new(currentPos.X, currentPos.Y + 10, currentPos.Z)
.Velocity
The speed and direction the Part is moving, represented as a Vector3 in studs per second.
local myPart = game.GetWorkspace().MyPart
-- Make the part fly upwards by setting its velocity with a Vector3
myPart.Velocity = Vector3.new(0, 100, 0)
-- Read the velocity back
local currentVelocity = myPart.Velocity
print("Current upward speed is: " .. currentVelocity.Y)
.CanCollide
Returns a bool value of whether the BasePart has CanCollide enabled or not. Can be used to set Collide.
.Transparency
The transparency of the Part. A value of 0 is completely opaque, and 1 is completely invisible.
-- Make the part semi-transparent
game.Workspace.MyPart.Transparency = 0.5
.Reflectance
How much the Part reflects its surroundings. A value of 0 is non-reflective (like matte plastic), and 1 is perfectly reflective (like a mirror).
game.Workspace.MyPart.Reflectance = 1
.Rotation
The orientation of the Part, represented as a Vector3. This property is read-only.
local myPart = game.GetWorkspace().MyPart
-- Get the rotation as a single Vector3 object
local currentRotation = myPart.Rotation
print(string.format("Current Y-axis rotation: %.2f", currentRotation.Y))
.LookVector
A unit vector (length of 1) that points in the direction of the Part's front (-Z) face. It's a Vector3 Object.
.RightVector
A unit vector (length of 1) that points in the direction of the Part's right (+X) face. It's a Vector3 Object.
.UpVector
A unit vector (length of 1) that points in the direction of the Part's top (+Y) face. It's a Vector3 Object.
.MeshId
The asset ID for a custom mesh.
.TextureId
The asset ID for a texture applied to the Part.
.DecalTextureId
The asset ID for a decal applied to the Part.
.SpecialMeshTextureId
The asset ID for the texture of a SpecialMesh object inside the Part.
.BonePosition
The 3D position of a bone object.
.ButtonPosition
The 2D position of a button object.
.ButtonSize
The size of a button object.
.VisibleFrame
A property related to whether the frame is visible or not
.HoldDuration
The time in seconds a user must hold an interaction, typically for a ProximityPrompt.
.MaxActivationDistance
The maximum distance in studs from which a user can interact with this Part, typically for a ProximityPrompt.
.ProximityActionText
The text displayed to the user when they are able to interact with this Part (e.g., "Open", "Talk").
.ProximityExclusivity
The exclusivity behavior of the ProximityPrompt (e.g., "OnePerButton").
.UserId
The unique numerical ID associated with the player's account.
print("My UserID is:", game.LocalPlayer.UserId)
.Team
The name of the Team the Player is currently on.
if game.LocalPlayer.Team == "Red" then
print("I'm on the Red team!")
end
.CameraMode
The current camera behavior for the player (e.g., "Classic", "LockFirstPerson").
.CameraMaxZoomDistance
The maximum distance in studs the player can zoom their camera out.
-- Allow the player to zoom out very far
game.LocalPlayer.CameraMaxZoomDistance = 1000
Humanoid
local my_humanoid = game.LocalPlayer.Character.Humanoid
local health_percentage = (my_humanoid.Health / my_humanoid.MaxHealth) * 100
print(string.format("I am at %.2f%% health.", health_percentage))
.MaxHealth
The maximum health of the Humanoid.
.MoveDirection
A unit vector representing the direction the Humanoid is currently moving, relative to the world. A vector of (0, 0, 0) means the Humanoid is standing still.
local move_dir_x, move_dir_y, move_dir_z = game.LocalPlayer.Character.Humanoid.MoveDirection
if move_dir_z < -0.5 then
print("I am moving forward!")
end
.Health
The health of the Humanoid.
Last updated