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

My output says HumanoidRootPart is not a valid member of Model Dummy2 Idk wtd it highlight line 30?

Asked by 3 years ago
wait(10)

local spawnTime = 5 -- the time in seconds
local spawnRate = 1 -- per spawn time

local pS = game:GetService("PhysicsService")
pS:CreateCollisionGroup("Minions")
pS:CollisionGroupSetCollidable("Minions", "Minions", false)

while script.Parent.Building.Health.Value > 0 do
wait(spawnTime)

for i = 1, spawnRate do
    wait()

    local dummy = game:GetService("ReplicatedStorage").Minions:GetChildren()[math.random(1, #game:GetService("ReplicatedStorage").Minions:GetChildren())]:Clone()
    dummy.Parent = script.Parent.Minions
    for i, v in pairs(dummy:GetChildren()) do
        if v:IsA("MeshPart") or v:IsA("Part") then
            pS:SetPartCollisionGroup(v, "Minions")
        end
    end
    dummy.HumanoidRootPart.CFrame = script.Parent.Spawn.CFrame

    local pFS = game:GetService("PathfindingService")

    spawn(function()
        for _, waypoints in pairs(script.Parent.Waypoints:GetChildren()) do
            local path = pFS:CreatePath()
            path:ComputeAsync(dummy.HumanoidRootPart.Position, waypoints.Position)
            local wp = path:GetWaypoints()
            for __, wp2 in pairs(wp) do
                dummy.Humanoid:MoveTo(wp2.Position)
                dummy.Humanoid.MoveToFinished:Wait()
            end
        end
    end)

    script.Parent.Building.Health.Value = script.Parent.Building.Health.Value - math.random(10, 15)
    dummy:Destroy()
end

end

1 answer

Log in to vote
0
Answered by 3 years ago

It Happens cause your game may be in R6 Humanoid root parts Are In R15 U can replace the HumanoidRootPart by Humanoid If You Want

0
thanks ryinestoyreview 7 — 3y
0
welcoem kidsteve923 139 — 3y
Ad

Answer this question