Do not use this system! It is extremely not optimized of memory and does not provide some necessary methods! (23.03.26)
Why u should use it?
Includes replication optimization, smooth rotation, and flexible movement control
Note
The system is unable to calculate elevation changes (tried using shapeCast)
Example of code
local EnemyController = require(ReplicatedStorage.EnemyController)
local enemy = EnemyController.new(
model, -- source model from ReplicatedStorage
Vector3.zero -- start position
)
-- Move to point
enemy:MoveTo(Vector3.new(10, 0, 5))
-- Move on path
enemy:MoveOnPath{
Vector3.new(10, 0, 0),
Vector3.new(10, 0, 10),
Vector3.new(0, 0, 10)
}
API
Read the API
function MoveTo(location: Vector3, callback: (() -> ())?)
Moves enemy to the specified location over time using current walk speed.
Parameters:
location: Vector3
The target position to move tocallback: (() → ())?
Optional function called when path is completed
function MoveOnPath(path: {Vector3}, callback: (() -> ())?)
Moves enemy through a series of waypoints sequentially.
Parameters:
path: {Vector3}
Array of Vector3 waypoints to follow in ordercallback: (() → ())?
Optional function called when entire path is completed
function Position(): Vector3
Returns the absolute enemy position
Returns:
Vector3- Absolute position
function Stane(location: Vector3?)
Stops movement and optionally teleports enemy to specified location.
Parameters:
location: Vector3?
Optional teleport destination (uses current position if nil)
function Damage(amount: number)
Applies damage to the enemy and triggers health events.
Parameters:
amount: number
Damage amount to subtract from current health
function SetWalkSpeed(speed: number)
Changes movement speed dynamically(even during active movement).
Parameters:
speed: number
New movement speed in studs/second
function Destroy()
Completely removes the enemy and cleans up all resources.
Events
-
event
MoveFinished: Signal<>
Fired when the enemy completes movement to a single point. -
event
HealthChanged: Signal
Fired when health changes,providing the new health value. -
event
Destroying: Signal<>
Fired right before the enemy is destroyed for cleanup operations.
