Skip to main content
onVerified is an optional callback passed to PlayWaveServer.init. It fires exactly once per player when the verification flow ends, regardless of whether the player is a PC cafe user. Without this callback, distinguishing “verification finished but the player is not a cafe user” from “verification still in progress” required polling isPcCafeUser (since onPcCafe only fires for cafe users). onVerified closes that gap.

Signature

onVerified = function(player, isPcCafe, reason)
    -- player:    Player instance
    -- isPcCafe:  boolean — confirmed value (always false on failure paths)
    -- reason:    string — one of PlayWaveServer.VerifyReason values
end
  • Fires exactly once per PlayWaveClientReady event
  • isPcCafe is always a boolean
  • reason is one of the values defined in PlayWaveServer.VerifyReason (see below)
  • Errors thrown inside the callback are caught with pcall, logged as warnings, and do not break the verify flow

When it fires

onVerified is invoked from inside the PlayWaveClientReady handler — i.e. after the client’s PlayWaveClient script signals readiness to the server. The exact firing point depends on the branch taken:
BranchFiring pointreasonisPcCafe
Teleport resumeAfter POST /game/session/check response, on session registrationRESUMED (success) or RESUME_REJECTED (any 4xx/5xx/network failure)success → inherited from origin / failure → false
Fresh OTT verificationAfter POST /game/session/verify responseVERIFIED (success) / REQUEST_FAILED (HTTP/network/decode error) / REJECTED (is_valid: false)success → server response value / failure → false
No OTT in LaunchDataImmediately, no HTTP callNO_OTTfalse
OTT without playwave_ prefixImmediately, no HTTP callINVALID_PREFIXfalse

Firing order with onPcCafe

For PC cafe users on the success path (where both fire):
  • Fresh OTT verification: onPcCafe + client PC_CAFE event → onVerified
  • Teleport resume: onVerifiedonPcCafe + client PC_CAFE event
The order between the two paths differs — do not depend on it. Use onVerified purely as a “verification flow ended” signal, and put PC-cafe-only side effects inside onPcCafe.

When it does NOT fire

  • TeleportInitFailed session restoration — the player is already verified before the teleport attempt, so re-firing would duplicate for the same player
  • PlayerRemoving — not a verification event

Verify reason values

The reason argument is one of the values defined on PlayWaveServer.VerifyReason:
ReasonMeaningisPcCafe
VERIFIEDOTT verification succeededserver response value
RESUMEDTeleport resume passed /game/session/checkinherited from origin
RESUME_REJECTEDTeleport resume failed server-side check (tampered, expired, etc.)always false
NO_OTTPlayer joined without an OTT in LaunchDataalways false
INVALID_PREFIXOTT did not start with the playwave_ prefix (treated as an unrelated token)always false
REQUEST_FAILEDverify HTTP / network / decode erroralways false
REJECTEDverify API returned is_valid: falsealways false

Usage example

local PlayWaveServer = require(script.PlayWaveServer)
local Reason = PlayWaveServer.VerifyReason

PlayWaveServer.init({
    apiKey = apiKey,
    apiUrl = apiUrl,

    onPcCafe = function(player)
        -- PC cafe-only benefits (fires only for cafe users)
    end,

    onVerified = function(player, isPcCafe, reason)
        if reason == Reason.VERIFIED or reason == Reason.RESUMED then
            -- Normal session — branch on isPcCafe
        else
            -- Verification did not produce a normal session
        end
    end,
})

Relationship with onPcCafe

OutcomeonPcCafeonVerified
Cafe user, verifiedfiresfires (VERIFIED, isPcCafe=true)
Non-cafe user, verifieddoes not firefires (VERIFIED, isPcCafe=false)
Resume succeeds, cafefiresfires (RESUMED, isPcCafe=true)
Resume rejecteddoes not firefires (RESUME_REJECTED, isPcCafe=false)
No OTT / prefix mismatch / request error / rejecteddoes not firefires with that reason, isPcCafe=false
onVerified is purely additive. Existing onPcCafe behavior is unchanged.

Notes

Even when RESUME_REJECTED indicates the server-side check for a teleport resume failed, the local session is left in place. The next heartbeat will return 404/410 and clean up automatically.