• Studio

  • Studio API

  • Bots

  • Web API

  • Designer Resources

  • Host Resources

  • Globals

    NetworkValue

    Base class for all networked value types (BoolValue, NumberValue, StringValue, etc.). Provides the Changed event that all value types inherit.

    Do not instantiate directly - use specific value types instead:

    • BoolValue
    • NumberValue
    • StringValue
    • IntValue
    • Vector2Value
    • Vector3Value
    • QuaternionValue
    • TableValue
    • NetworkObjectValue

    Available on: Client and Server scripts

    Properties

    Changed

    ClientAndServer
    ReadOnly

    Event fired when the value changes. All value types (BoolValue, NumberValue, etc.) inherit this event.

    IMPORTANT:

    • Values should be changed on the server
    • Connect to this event on the client to receive updates

    Event Parameters: newValue: The new value oldValue: The previous value

    -- Server: Create and modify value
    --!Type(Server)
    local score = NumberValue.new("PlayerScore", 0)
    
    function self:ServerStart()
        -- Change value on server
        score.value = 100
    end
    
    -- Client: Listen for changes
    --!Type(Client)
    local score = NumberValue.new("PlayerScore", 0)
    
    function self:ClientStart()
        score.Changed:Connect(function(newVal, oldVal)
            print("Score updated: " .. newVal)
            -- Update UI here
        end)
    end
    
    -- Example with BoolValue
    local gameActive = BoolValue.new("GameActive", false)
    
    gameActive.Changed:Connect(function(newVal, oldVal)
        if newVal then
            print("Game started!")
        else
            print("Game ended!")
        end
    end)
    
    -- Example with Vector3Value
    local targetPos = Vector3Value.new("TargetPosition", Vector3.zero)
    
    targetPos.Changed:Connect(function(newPos, oldPos)
        print("Target moved from " .. tostring(oldPos) .. " to " .. tostring(newPos))
    end)
    

    Updated 13 days ago

    PocketWorlds Icon

    © 2025 Pocket Worlds. All rights reserved.