ScriptConnection

Overview

ScriptConnection은 이벤트에 루아 스크립트로 작성한 함수를 이어주는 연결 객체입니다.

이 객체는 Connect 호출 시 생성되며, 필요할 때 Disconnect 기능을 통해 이벤트 수신을 중단할 수 있도록 해주어 이벤트 관리에 중요한 역할을 합니다.

Constructors

Properties

Connected

boolean

이벤트의 연결 상태를 나타내는 속성입니다.

Disconnect 메서드가 호출되면 false값이 반환됩니다.

Code Samples

local Players = game:GetService("Players")
local Connection = nil

local function EnterPlayer(player)
    print("EnterPlayer : ", player.Name)
end
Connection = Players.PlayerAdded:Connect(EnterPlayer)

if Connection.Connected then
    print("The connection is active.")
else
    print("The connection has been disconnected.")
end

Methods

Disconnect

이벤트의 연결을 해제하여, 더 이상 해당 신호를 수신하지 않도록 만듭니다.

Parameters

Return

void

Code Samples

Events

See also

이벤트

Last updated