Closed lttzy closed 3 months ago
shared/networt.ts import { Networking } from "@flamework/networking";
import { Networking } from "@flamework/networking";
interface ClientToServerEvents { event(param1: string): void; } interface ServerToClientEvents { event(param1: string): void; } // Returns an object containing aserverandclientfield. export const GlobalEvents = Networking.createEvent<ClientToServerEvents, ServerToClientEvents>();
interface ClientToServerEvents {
event(param1: string): void;
}
interface ServerToClientEvents {
// Returns an object containing a
and
field.
export const GlobalEvents = Networking.createEvent<ClientToServerEvents, ServerToClientEvents>();
server/services/example.ts import { GlobalEvents } from "shared/network"; GlobalEvents.event.fire() when I call GlobalEvents to fire, throw an error Property 'event' does not exist on type 'GlobalEvent<ClientToServerEvents, ServerToClientEvents>'
import { GlobalEvents } from "shared/network";
GlobalEvents.event.fire()
Please refer to the documentation.
There is also the Flamework template which already has networking setup.
shared/networt.ts
import { Networking } from "@flamework/networking";
interface ClientToServerEvents {
event(param1: string): void;
}
interface ServerToClientEvents {
event(param1: string): void;
}// Returns an object containing a
serverand
clientfield.
export const GlobalEvents = Networking.createEvent<ClientToServerEvents, ServerToClientEvents>();
server/services/example.ts
import { GlobalEvents } from "shared/network";
GlobalEvents.event.fire()
when I call GlobalEvents to fire, throw an error Property 'event' does not exist on type 'GlobalEvent<ClientToServerEvents, ServerToClientEvents>'