2026-02-12 09:53:57 +00:00
|
|
|
# Getting Started <Badge type="tip" text="1.1" />
|
2024-01-05 12:14:38 +00:00
|
|
|
|
2026-02-12 09:53:57 +00:00
|
|
|
### `Installation`
|
2024-01-05 12:14:38 +00:00
|
|
|
First, you have to require the Warp module.
|
|
|
|
|
|
|
|
|
|
```lua
|
2026-02-12 09:53:57 +00:00
|
|
|
local Warp = require(path.to.module)
|
2024-01-05 12:14:38 +00:00
|
|
|
```
|
|
|
|
|
|
2026-02-12 09:53:57 +00:00
|
|
|
Then, you should do `.Server` or `.Client`
|
2024-01-05 12:14:38 +00:00
|
|
|
|
|
|
|
|
```lua
|
2026-02-12 09:53:57 +00:00
|
|
|
local Server = Warp.Server() --> for Server-side only
|
|
|
|
|
local Client = Warp.Client() --> for Client-side only
|
2024-01-05 12:14:38 +00:00
|
|
|
```
|
|
|
|
|
|
2026-02-12 09:53:57 +00:00
|
|
|
### `Basic Usage`
|
2024-01-05 12:14:38 +00:00
|
|
|
Firing event everytime player join
|
|
|
|
|
|
|
|
|
|
```lua
|
|
|
|
|
local Players = game:GetService("Players")
|
|
|
|
|
|
2026-02-12 09:53:57 +00:00
|
|
|
Players.PlayerAdded:Connect(function(player: Player)
|
|
|
|
|
Server.Fire("MessageEvent", true, player, "Welcome!")
|
2024-01-05 12:14:38 +00:00
|
|
|
end)
|
2026-02-12 09:53:57 +00:00
|
|
|
```
|
|
|
|
|
Add a listener (works for both `.Invoke` & `.Fire`)
|
|
|
|
|
|
|
|
|
|
```lua
|
|
|
|
|
local connection = Server.Connect("Ping", function(player: Player)
|
|
|
|
|
return "Pong"
|
|
|
|
|
end)
|
|
|
|
|
print(connection.Connected)
|
|
|
|
|
-- connection:Disconnect()
|
|
|
|
|
```
|
|
|
|
|
Send or Request a event
|
|
|
|
|
|
|
|
|
|
```lua
|
|
|
|
|
-- Reliable-RemoteEvent
|
|
|
|
|
Client.Fire("test", true, "hey")
|
|
|
|
|
-- Unreliable-RemoteEvent
|
|
|
|
|
Client.Fire("test", false, "hello from client!!")
|
|
|
|
|
-- Invoke
|
|
|
|
|
local response = Client.Invoke("Ping")
|
|
|
|
|
if not response then
|
|
|
|
|
warn("Server didn't ping back :(")
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
print(response, "from Server!")
|
2024-01-05 12:14:38 +00:00
|
|
|
```
|