Skip to content

self

Global · self · server and client scripts

self: Entity

self is the entity that runs the script, usually the part the script is attached to. Every script on that entity gets the same self. In a script under scripts/autorun/, self is nil; see scripts that run for the whole place.

Example

-- Server script in a part: the part disappears when something touches it.
self:On(Component.Collider.Touched, function()
    self:Destroy()
end)