Monster again lol
Key RequiredUniversal

Monster again lol

Universal ScriptDandyAndAstroAreSusDandyAndAstroAreSus 3.6K views 21 executesUpdated Feb 21, 2025
Unrated
00
Lua Script•41 lines (1302 chars)
local monster = script.Parent
local player = game.Players.LocalPlayer
local character = player.Character
local hum = character:WaitForChild("Humanoid")
local root = character:WaitForChild("HumanoidRootPart")

function findClosestPlayer()
    local closestPlayer = nil
    local closestDistance = math.huge

    for i, v in ipairs(game.Players:GetPlayers()) do
        if v ~= player then
            local vChar = v.Character
            if vChar then
                local vRoot = vChar:WaitForChild("HumanoidRootPart")
                local distance = (root.Position - vRoot.Position).Magnitude

                if distance < closestDistance then
                    closestPlayer = v
                    closestDistance = distance
                end
            end
        end
    end

    return closestPlayer
end

function chasePlayer(playerToChase)
    local playerRoot = playerToChase.Character:WaitForChild("HumanoidRootPart")
    local targetDirection = (playerRoot.Position - root.Position).Unit
    local moveDirection = CFrame.new(root.Position, root.Position + targetDirection) * CFrame.Angles(0, math.rad(90), 0)
    monster:MoveTo(moveDirection)
end

while wait() do
    local closestPlayer = findClosestPlayer()
    if closestPlayer then
        chasePlayer(closestPlayer)
    end
end

Features & Information

Uhsh

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts