Universal Script 📌
3.6k Views
49 Executions

Monster again lol

Universal Script 📌
2 years ago
Get an executor
Please login to perform these actions:

Does it work?

No reports yet

No reports yet. Tried it? Be the first to say.

Also noticed:

Description

Uhsh

Updates

  1. Script edited: Create script

View Raw
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


Comments

0
Log in to join the conversation. Login
No comments yet. Be the first!

More universal scripts

See all
Script hub
3.6M
857.3k
Bumped 2 hours ago
Key System

Script hub

Hall of Fame #6

Verified script badgeFlow Hub | 50 Games | Updated

Universal Script 📌
28.2k
91.1k
Bumped 3 hours ago
Key System
Script hub
4.0M
2.4M
Bumped 5 hours ago

Script hub

Hall of Fame #3

KeylessVerified script badge[KEYLESS] Moondiety Script | 27+ supported Games

Script hub
197.5k
2.1M
Bumped 6 hours ago
Key System

Script hub

#21 this week

Verified script badgeAirflow HUB