Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local BHealth = 1000
- local sight = 150
- local function Load(plrcount)
- local MaxHealth = BHealth
- local Health = MaxHealth
- local Name = script.Parent.Name
- local Model = script.Parent
- spawn(function() require(script.Parent.Animate)() end)
- local Humanoid = Model:FindFirstChild("Humanoid")
- local infobar = Model.Head.PlayerInfoBar
- infobar.PlrName.Text = Model.Name
- Humanoid.Health = Health
- Humanoid.MaxHealth = MaxHealth
- require(script.Parent.Targets).Range(sight)
- infobar.HPText.Text = tostring(Health).." / "..tostring(MaxHealth).." HP"
- local touchhandler = require(game:GetService("ServerScriptService").Libraries.OnTouched)
- touchhandler.ConnectEvents(Model:WaitForChild("Torso"))
- Humanoid.Changed:connect(function()
- Health = Humanoid.Health
- if infobar == nil then return end
- if not infobar:FindFirstChild("HPText") then return end
- infobar.HPText.Text = tostring(Health).." / "..tostring(MaxHealth).." HP"
- end)
- Humanoid.Died:connect(function()
- Health = 0
- if infobar == nil then return end
- if not infobar:FindFirstChild("HPText") then return end
- infobar.HPText.Text = tostring(Health).." / "..tostring(MaxHealth).." HP"
- end)
- Humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
- Humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
- local startposition = Model.Torso.Position
- local Special = true
- local CLOSEDAMAGE = 0
- local WAITTIME = 2
- local range = 10
- local DamageMod = require(game:GetService("ServerScriptService").Libraries.DamageService)
- spawn(function()
- while wait(WAITTIME / 2) and Model:FindFirstChild("SLP") do
- if Model.SLP.Value == 0 then
- local x = math.random(-range, range)
- local z = math.random(-range, range)
- Model.Humanoid.WalkToPoint = Vector3.new(startposition.x + x, 0, startposition.z + z)
- end
- wait(WAITTIME / 2)
- if not Model:FindFirstChild("SLP") then return end
- if Model.SLP.Value == 0 then
- -- FIGHTING
- wait(2)
- for _, i in pairs(script.Parent.Targets:GetChildren()) do
- local player = Players:GetPlayerFromCharacter(workspace:FindFirstChild(i.Name)) or workspace:FindFirstChild(i.Name)
- local char = workspace:FindFirstChild(i.Name)
- if DamageMod:CanDamage(Model, player) then
- local rskill = math.random(1, #script.Skills:GetChildren())
- require(script.Skills:GetChildren()[rskill])(Model, char.Torso.Position - (Model.Torso.CFrame * CFrame.new(0,0,-7)).Position)
- end
- end
- end
- end
- end)
- repeat wait() until Health <= 0
- end
- return Load
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement