Network.sendToClients

Sends a network event from the server to all clients. This will run the callback method on every client with optional arguments.

Kind: Function

Environments: Game

Game

network:sendToClients( callbackMethod, args )

Open the full Game reference

Availability: Server only

-- Example of calling client function over network
function MyHorn.server_onSledgehammer( self, position, player ) 
    self.network:sendToClients( 'client_hit', position )
end

function MyHorn.client_hit( self, position ) 
    -- Play sound
    sm.audio.play( 'Horn', position )
end

Parameters:

Name Type Description
network Network The network.
callbackMethod string The client function name.
args (optional) any Optional arguments to be sent to the client.