-- Boss Behavior
local BossBehavior = {}
BossBehavior.__index = BossBehavior
-- Constructor
function BossBehavior.new(bossModel)
local self = setmetatable({}, BossBehavior)
self.BossModel = bossModel
self.Humanoid = bossModel:FindFirstChildOfClass("Humanoid")
self.RootPart = bossModel:FindFirstChild("HumanoidRootPart")
return self
end
-- Called when boss is created/spawned (server-side)
function BossBehavior:Created()
if self.Humanoid then
self.Humanoid.MaxHealth = 10000
self.Humanoid.Health = 10000
self.Humanoid.WalkSpeed = 10
end
if self.RootPart then
self.RootPart.Anchored = false
end
print("Boss Created:", self.BossModel.Name)
end
-- Called when boss hits a player (server-side)
function BossBehavior:OnHit(targetPlayer)
print("Boss hit player:", targetPlayer.Name)
-- Example: Damage player
local humanoid = targetPlayer.Character and targetPlayer.Character:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid.Health = humanoid.Health - 50
end
end
-- Called when a player is in range (server-side)
function BossBehavior:TargetInRange(targetPlayer)
print("Player in range:", targetPlayer.Name)
-- Example: Start attack animation (client-side should handle visuals)
end
-- Called on client to play boss animations
function BossBehavior:PlayAnimation(animName)
-- This should be called from client-side
print("Play animation:", animName)
-- Example: Load and play animation on boss humanoid
end
-- Called on client to update UI
function BossBehavior:UpdateHealthBar(currentHealth, maxHealth)
-- This should be called from client-side
print("Update health bar:", currentHealth, "/", maxHealth)
end
return BossBehavior