OnInstanceEnter||doc136824

September 20, 2022

Format

local event = BasePart:GetEvent("OnInstanceEnter")

Describe

Triggered when an instance enters the scene.

Callback function parameters

Type name introduce
Map map Current scene
Instance ins Enter the instance of the scene

Code example

Register the instance on the server and enter the static scenario "map001" event

local map = World:GetStaticMap("map001")

local event = part1:GetEvent("OnInstanceEnter")
event:Bind(function(map, ins)
    print("OnInstanceEnter!", map, ins)
end)

local part = Instance.new("Part", map.Root)