-- Initialize services and variables local player = game.Players.LocalPlayer local mouse = player:GetMouse() local Character = player.Character or player.CharacterAdded:Wait() local screenGui = Instance.new("ScreenGui", player.PlayerGui) local buttonSize = UDim2.new(0, 150, 0, 50) local minions = {} -- UI Button Creation local function createButton(text, position, color) local button = Instance.new("TextButton", screenGui) button.Size = buttonSize button.Position = position button.BackgroundColor3 = color button.Text = text return button end local spawnButton = createButton("Spawn Minion", UDim2.new(0, 10, 0, 10), Color3.new(0, 0.5, 1)) local attackButton = createButton("Attack", UDim2.new(0, 10, 0, 70), Color3.new(1, 0.5, 0)) local callButton = createButton("Call Minions", UDim2.new(0, 10, 0, 130), Color3.new(0, 1, 0.5)) local clearButton = createButton("Clear Minions", UDim2.new(0, 10, 0, 190), Color3.new(1, 0, 0)) -- Function to spawn a minion local function spawnMinion() local minion = Instance.new("Model", workspace) minion.Name = "Minion" local humanoid = Instance.new("Humanoid", minion) -- Create the torso local torso = Instance.new("Part", minion) torso.Name = "Torso" torso.Size = Vector3.new(2, 2, 2) torso.Position = Character.PrimaryPart.Position + Vector3.new(0, 5, 0) torso.Anchored = false torso.BrickColor = BrickColor.new("Light blue") -- Create the head local head = Instance.new("Part", minion) head.Name = "Head" head.Size = Vector3.new(2, 2, 2) head.Position = torso.Position + Vector3.new(0, 2, 0) head.Anchored = false head.BrickColor = BrickColor.new("Bright yellow") -- Weld the head to the torso local weld = Instance.new("Weld", head) weld.Part0 = torso weld.Part1 = head weld.C0 = CFrame.new(0, 2, 0) -- Create eyes (optional, cosmetic) local leftEye = Instance.new("Part", minion) leftEye.Size = Vector3.new(0.5, 0.5, 0.5) leftEye.Position = head.Position + Vector3.new(-0.5, 0.5, -1) leftEye.Anchored = false leftEye.BrickColor = BrickColor.new("White") local rightEye = Instance.new("Part", minion) rightEye.Size = Vector3.new(0.5, 0.5, 0.5) rightEye.Position = head.Position + Vector3.new(0.5, 0.5, -1) rightEye.Anchored = false rightEye.BrickColor = BrickColor.new("White") -- Weld eyes to the head local leftEyeWeld = Instance.new("Weld", leftEye) leftEyeWeld.Part0 = head leftEyeWeld.Part1 = leftEye leftEyeWeld.C0 = CFrame.new(-0.5, 0.5, -1) local rightEyeWeld = Instance.new("Weld", rightEye) rightEyeWeld.Part0 = head rightEyeWeld.Part1 = rightEye rightEyeWeld.C0 = CFrame.new(0.5, 0.5, -1) -- Make the torso the PrimaryPart for movement control minion.PrimaryPart = torso table.insert(minions, minion) end -- Function for random idle chats local idleChats = {"Banana!", "Me want banana!", "HAHA!", "Bello!","YEAAAAAHHH!"} local function randomChat(minion) local head = minion:FindFirstChild("Head") if head then local chat = idleChats[math.random(1, #idleChats)] game:GetService("Chat"):Chat(head, chat) end end -- Function to make the minions walk freely local function minionsWalkFreely() for _, minion in ipairs(minions) do local humanoid = minion:FindFirstChild("Humanoid") if humanoid then humanoid:MoveTo(minion.PrimaryPart.Position + Vector3.new(math.random(-10, 10), 0, math.random(-10, 10))) end end end -- Function to find the closest player (for the minion to attack) local function findClosestPlayer(minion) local closestPlayer = nil local closestDistance = math.huge -- Set a very high initial distance for _, targetPlayer in pairs(game.Players:GetPlayers()) do if targetPlayer ~= player and targetPlayer.Character and targetPlayer.Character:FindFirstChild("HumanoidRootPart") then local targetPosition = targetPlayer.Character.HumanoidRootPart.Position local distance = (minion.PrimaryPart.Position - targetPosition).Magnitude if distance < closestDistance then closestDistance = distance closestPlayer = targetPlayer end end end return closestPlayer end -- Function to make the minions attack players local function attackPlayers() for _, minion in ipairs(minions) do local humanoid = minion:FindFirstChild("Humanoid") if humanoid then local targetPlayer = findClosestPlayer(minion) if targetPlayer and targetPlayer.Character then local targetPosition = targetPlayer.Character.PrimaryPart.Position humanoid:MoveTo(targetPosition) -- Attack logic when close to the target humanoid.MoveToFinished:Wait() -- Wait until the minion reaches the target if (minion.PrimaryPart.Position - targetPosition).Magnitude < 5 then -- If the minion is close enough to the player, "attack" local targetHumanoid = targetPlayer.Character:FindFirstChild("Humanoid") if targetHumanoid then targetHumanoid:TakeDamage(100) -- Deals 100 damage end end end end end end -- Function to call all minions to the player and make them say "Yes, Gru!" local function callMinions() for _, minion in ipairs(minions) do local humanoid = minion:FindFirstChild("Humanoid") local head = minion:FindFirstChild("Head") if humanoid and head then humanoid:MoveTo(Character.PrimaryPart.Position + Vector3.new(math.random(-5, 5), 0, math.random(-5, 5))) game:GetService("Chat"):Chat(head, "Yes, Gru!") end end end -- Clear all minions local function clearMinions() for _, minion in ipairs(minions) do minion:Destroy() end minions = -- Button functionality spawnButton.MouseButton1Click:Connect(spawnMinion) attackButton.MouseButton1Click:Connect(attackPlayers) -- Normal attack mode, no toggle callButton.MouseButton1Click:Connect(callMinions) clearButton.MouseButton1Click:Connect(clearMinions) -- Random idle chats every 10 seconds while true do wait(10) for _, minion in ipairs(minions) do randomChat(minion) minionsWalkFreely() -- Minions freely walk when not attacking end end