Skip to content

Client functions ​

These hooks are in the unlocked file bridge/functions/client.lua. Put your own code inside them. They run on the player who entered, left, or is inside the safezone.

The zone argument contains:

  • id
  • name
  • settings
  • polyzone

Treat it as read-only. Use the GetCurrentSafezone export when you need a copy you can change.

Client Functions ​

1. Player Enter Zone - FSBridge.Functions.OnEnterZone(zone)

Runs when the local player enters a safezone.

Source file:

  • bridge/functions/client.lua

Arguments:

  • zone - table containing the current safezone data

Example:

lua
function FSBridge.Functions.OnEnterZone(zone)
    print('Entered safezone:', zone and zone.name)

    if zone and zone.id then
        print('Safezone ID:', zone.id)
    end
end
2. Player Leave Zone - FSBridge.Functions.OnLeaveZone(zone)

Runs when the local player leaves a safezone.

Source file:

  • bridge/functions/client.lua

Arguments:

  • zone - table containing the last safezone data

Example:

lua
function FSBridge.Functions.OnLeaveZone(zone)
    print('Left safezone:', zone and zone.name)
end
3. Player Inside Zone - FSBridge.Functions.InsideZone(zone)

Runs every 500 ms while the local player stays inside a safezone (not every frame, to keep resmon low).

Source file:

  • bridge/functions/client.lua

Arguments:

  • zone - table containing the current safezone data

Keep this light. It's useful for custom checks or repeated effects while the player remains inside the zone.

Example:

lua
function FSBridge.Functions.InsideZone(zone)
    if zone and zone.settings then
        print('Inside safezone with current settings loaded.')
    end
end

Client Events ​

4. Client Events

Safezone Creator triggers these client events. Each one also fires under the old fs_safezonecreator: prefix, so older scripts keep working.

EventWhen
fwb_safezonecreator:client:onEnterZoneThe local player enters a zone
fwb_safezonecreator:client:onExitZoneThe local player leaves a zone
fwb_safezonecreator:client:insideZoneEvery 500 ms while inside a zone

Example:

lua
AddEventHandler('fwb_safezonecreator:client:onEnterZone', function(zone)
    if zone then
        print(('Client entered safezone: %s'):format(zone.name or 'unknown'))
    end
end)

AddEventHandler('fwb_safezonecreator:client:onExitZone', function(zone)
    if zone then
        print(('Client left safezone: %s'):format(zone.name or 'unknown'))
    end
end)

AddEventHandler('fwb_safezonecreator:client:insideZone', function(zone)
    if zone and zone.id then
        print(('Client is inside safezone #%s'):format(zone.id))
    end
end)

FWB Studio documentation.