Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Trying to make a morph that spawns 7 bodyguards, but only 1 spawns (?)

Asked by 2 years ago

As the title says, whenever you morph Into a certain troll, 7 bodyguards appear, the problem Is that only 1 appears

script:

local Pathfinding = game:GetService("PathfindingService")
local EpicGuy

if script.Parent.Parent == game.Workspace then
    script.Parent.Humanoid:UnequipTools()
    wait(0.5)
    for i=0, 7 do
        EpicGuy = game:GetService("ReplicatedStorage")["Ally NPCS"]["Mafia Minion"]:Clone()
        EpicGuy.Parent = script.Parent.Minions
        EpicGuy.Torso.CFrame = script.Parent.Torso.CFrame
        while wait() do
            local Path = Pathfinding:CreatePath()
            Path:ComputeAsync(EpicGuy.Torso.Position,script.Parent.Torso.Position)
            if Path.Status == Enum.PathStatus.Success then
                local Waypoints = Path:GetWaypoints()

                for i,v in pairs(Waypoints) do
                    local Waypoint = Instance.new("Part",game.Workspace)
                    Waypoint.Position = v.Position
                    Waypoint.Anchored = true
                    Waypoint.CanCollide = false
                    Waypoint.Transparency = 1
                    EpicGuy.Humanoid:MoveTo(Waypoint.Position)
                    EpicGuy.Humanoid.MoveToFinished:Wait()
                    game:GetService("Debris"):AddItem(Waypoint,0)
                end
            end
        end
        wait()
    end
end

1 answer

Log in to vote
0
Answered by 2 years ago
  1. Never Ever use Torso. Torso Is used for R6. R6 Is never used on people anymore so change torso to HumanoidRootPart since its on both.

  2. I think you dont need while wait() for the for i loop.

  3. Check the output for problems.

  4. If none works, then add local num = 0. Then change for i loop into repeat. Then put num = num + 1 then beside until put num == 7 and after the repeat loop do num = 0

0
The morph (and the bodyguards) are literally R6 imnotaguest1121 362 — 2y
0
I guess so. Did the rest work? Brioche_Noodle 45 — 2y
Ad

Answer this question