Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- WELDING
- local function Weld(P0, P1, WeldPoint)
- local Weld = Instance.new("Weld", P1)
- Weld.Part0 = P0
- Weld.Part1 = P1
- Weld.C0 = P0.CFrame:inverse() * P1.CFrame
- return Weld
- end
- for _, Boss in pairs(script.Parent:GetChildren()) do
- if Boss:IsA'Model' then
- for _, Child in pairs(Boss:GetChildren()) do
- if Child:IsA'BasePart' then
- if Boss:FindFirstChild("E"..Child.Name) then
- for _, Part in pairs(Boss["E"..Child.Name]:GetChildren()) do
- if Part:IsA'BasePart' and Part.Name ~= "Middle" then
- Weld(Child, Part)
- Part.Anchored = false
- Part.CanCollide = false
- end
- end
- end
- Child.Anchored = false
- end
- end
- end
- end
- -- ~~BOSS~~ Enem HANDLING
- local Stats = require(game:GetService("ServerScriptService"):WaitForChild("Stats"))
- -- COPYING ~~BOSSES~~ enemy
- local Enemies = {}
- local EneData = {}
- function EnemySpawn(enename)
- EneData[enename].Character = Enemies[enename]:Clone()
- EneData[enename].Character.Parent = script.Parent
- require(EneData[enename].Character.Behavior)()
- if script:FindFirstChild(enename.."Reward") then require(script[enename.."Reward"])(Stats,EneData[enename].Character) end -- Rewards not moved into the sibling model because it would get cloned unnecessarily
- EneData[enename].Character:Destroy()
- EneData[enename].Character = nil
- end
- for _, i in pairs(script.Parent:GetChildren()) do
- if i.Name ~= script.Name then
- Enemies[i.Name] = i:Clone()
- i:Destroy()
- EneData[i.Name] = {
- Character = nil,
- Respawn = Enemies[i.Name]:FindFirstChild("Respawn") and Enemies[i.Name].Respawn.Value or 20
- }
- coroutine.wrap(function()
- while true do
- EnemySpawn(i.Name)
- print(EneData[i.Name].Respawn)
- wait(EneData[i.Name].Respawn)
- print("888888888888888888888888888888")
- end
- end)()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement