You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Returns an object containing a server and client field.
export const GlobalEvents = Networking.createEvent<ClientToServerEvents, ServerToClientEvents>();
// It is recommended that you create these in separate server/client files,
// which will avoid exposing server configuration (including type guards) to the client.
export const ServerEvents = GlobalEvents.createServer({
/* server config /
});
export const ClientEvents = GlobalEvents.createClient({
/ client config */
}); server/service/MonsterService
import { Service, OnStart } from "@flamework/core";
import { RunService, Workspace } from "@rbxts/services";
import { Monster } from "shared/components/creature";
import { GlobalEvents } from "shared/network";
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
shared/network.ts
`
import { Networking } from "@flamework/networking";
interface ClientToServerEvents {
event(param1: string): void;
}
interface ServerToClientEvents {
event(param1: string): void;
}
// Returns an object containing a
server
andclient
field.export const GlobalEvents = Networking.createEvent<ClientToServerEvents, ServerToClientEvents>();
// It is recommended that you create these in separate server/client files,
// which will avoid exposing server configuration (including type guards) to the client.
export const ServerEvents = GlobalEvents.createServer({
/* server config /
});
export const ClientEvents = GlobalEvents.createClient({
/ client config */
});
server/service/MonsterService
import { Service, OnStart } from "@flamework/core";
import { RunService, Workspace } from "@rbxts/services";
import { Monster } from "shared/components/creature";
import { GlobalEvents } from "shared/network";
@service()
export class MonsterService implements OnStart {
private monsters: Monster[] = [];
}
`
the line 23 throw an error: Property 'event' does not exist on type 'GlobalEvent<ClientToServerEvents, ServerToClientEvents>'
Beta Was this translation helpful? Give feedback.
All reactions