import{_ as t,D as n,c as l,m as s,a as i,I as p,U as a,o as h}from"./chunks/framework.BouBWMxc.js";const B=JSON.parse('{"title":"Server","description":"","frontmatter":{},"headers":[],"relativePath":"api/1.0/server.md","filePath":"api/1.0/server.md"}'),k={name:"api/1.0/server.md"},d=a(`
For Server-sided
.Server
Create new Warp event.
(
Identifier: string,
rateLimit: {
maxEntrance: number,
interval: number,
}?
)
local Remote = Warp.new("Remote")
:Connect
Connect event to receive incoming from client way.
(
player: Player,
callback: (...any) -> ()
): string
Remote:Connect(function(player, ...)
print(player, ...)
end)
:Once
This function likely :Connect
but it disconnect the event once it fired.
(
player: Player,
callback: (...any) -> ()
)
Remote:Once(function(player, ...)
print(player, ...)
end)
:Disconnect
Disconnect the event connection.
(
key: string
)
local connection = Remote:Connect(function(player, ...) end) -- store the key
Remote:Disconnect(connection)
:DisconnectAll
Disconnect All the event connection.
Remote:DisconnectAll()
:Fire
Fire the event to a client.
(
reliable: boolean,
player: Player,
...: any
)
Remote:Fire(true, player, "Hello World!")
Fire the event to all clients.
(
reliable: boolean,
...: any
)
Remote:Fires(true, "Hello World!")
:Invoke
Semiliar to :InvokeClient
, its for Invoke to a client.
(
timeout: number,
player: Player,
...: any
) -> (...any)
local Request = Remote:Invoke(2, player, "Hello World!")
WARNING
This function is yielded, once it timeout it will return nil.
:Wait
Wait the event being triggered.
Remote:Wait()
WARNING
This function is yielded, Invoke might also ping this one and also causing error.
:Destroy
Disconnect all connection of event and remove the event from Warp.
Remote:Destroy()