local Run = game:GetService("RunService")
local Player = game:GetService("Players").LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()
local Root = Char:WaitForChild("HumanoidRootPart")
local Hum = Char:WaitForChild("Humanoid")
local WinPart = workspace:FindFirstChild("WinsStage", true) and workspace.WinsStage["18"].Wins.T
local Enemies = workspace:WaitForChild("Enemies")
Run.RenderStepped:Connect(function()
if WinPart then
WinPart.CanCollide = false
WinPart.CFrame = Root.CFrame * CFrame.new(0, -3.5, 0)
end
local closest, minD = nil, math.huge
for _, e in pairs(Enemies:GetChildren()) do
local eRoot = e:FindFirstChild("HumanoidRootPart")
if eRoot then
local dist = (Root.Position - eRoot.Position).Magnitude
if dist < minD then closest, minD = eRoot, dist end
end
end
if closest then Hum:MoveTo(closest.Position) end
end)
Comments
No comments yet
Be the first to share your thoughts!