So I am making a boss and it goes around the arena and it tweens to random parts. But I want it to tween to the random parts that the player is close to I don’t know how to achieve this!
The parts that are in this arena are the parts that the boss randomly chooses.
Also the boss has 2 fazes so when the boss gets in the arena it automatically starts with faze 1 then after some time it goes to faze 2.
Main Script:
local ts = game:GetService('TweenService')
local F1_Script = script.Parent:WaitForChild('F1')
local F2_Script = script.Parent:WaitForChild('F2')
local partsFolder = game.Workspace.BossParts
local parts = partsFolder:GetChildren()
local boss = script.Parent
local function appear()
local function tween()
local info = TweenInfo.new(2,Enum.EasingStyle.Elastic,Enum.EasingDirection.Out,0,false,0)
local goal = {Transparency = 0, Position = Vector3.new(-25.902, 7.644, 156.334)}
--
local Tween = ts:Create(boss,info,goal)
Tween:Play()
end
print("THE EYE BOSS HAS APPEARED!")
tween()
end
wait(3)
appear()
wait(2.55)
F1_Script.Disabled = false
wait(8)
F1_Script.Disabled = true
wait()
print("Faze2!")
F2_Script.Disabled = false
Faze1 script:
local ts = game:GetService("TweenService")
local partsFolder = game.Workspace.BossParts
local parts = partsFolder:GetChildren()
local part = script.Parent
local wait1 = math.random(1.5,3)
local wait2 = math.random(1,2)
for _, aPart in ipairs(parts) do
local new = ts:Create(part, TweenInfo.new(wait1,Enum.EasingStyle.Bounce,Enum.EasingDirection.Out,0,false,0), {Position = aPart.Position})
new:Play()
new.Completed:Wait()
task.wait(wait2)
end
Faze 2 script:
local ts = game:GetService(“TweenService”)
local partsFolder = game.Workspace.BossParts
local parts = partsFolder:GetChildren()
local part = script.Parent
local wait1 = math.random(2,4)
local wait2 = math.random(1,2)
for _, aPart in ipairs(parts) do
local new = ts:Create(part, TweenInfo.new(wait1,Enum.EasingStyle.Bounce,Enum.EasingDirection.Out,0,false,0), {Position = aPart.Position})
new:Play()
new.Completed:Wait()
task.wait(wait2)
end