NetNPC
This is the server-side class for NetNPC.
Class Instance Methods
Inherited methods from NetObject
NetObject:SetData(key: string, value: any, broadcast: bool): boolean
Sets generic data on the object. Value must be a number, string, bool, vec2, vec3, vec4, or quat. If broadcast is true, the data will be synchronized to all clients. Returns true if the data was set successfully, false otherwise (for unsupported types).
Parameters:
key: string- The key to store the data undervalue: any- The value to store (must be a supported type)broadcast: bool- Whether to synchronize the data to all clients
Returns: boolean - true if the data was set successfully, false otherwise
Example:
-- Set data and broadcast to all clients
local success = object:SetData("serverValue", 100, true)
if success then
print("Data set and broadcast successfully")
else
print("Failed to set data")
end
-- Set data only on server
local success = object:SetData("localValue", 50, false)