#mobs do not pass through the player (collision problem)

17 messages · Page 1 of 1 (latest)

cold micaBOT
#

studio** You are now Level 1! **studio

vale heron
#

it says this

blissful tendon
vale heron
#

sry forgot

#

local PhysicsService = game:GetService("PhysicsService")
local ServerStorage = game:GetService("ServerStorage")
local mob = {}

function mob.Move(mob, map)
local humanoid = mob:WaitForChild("Humanoid")
local waypoints = workspace.Waypoints

for waypoint=1, #waypoints:GetChildren() do
    humanoid:MoveTo(waypoints[waypoint].Position)
    humanoid.MoveToFinished:Wait()
end

mob:Destroy()

end
function mob.Spawn(name, quanity, map)
local mobExists = ServerStorage.Mobs:FindFirstChild(name)

if mobExists then
    for i=1, quanity do
        task.wait(0.5)
        local newMob = mobExists:Clone()
        newMob.HumanoidRootPart.CFrame = map.Start.CFrame
        newMob.Parent = map.Mob
        newMob.HumanoidRootPart:SetNetworkOwner(nil)    
        
        for i, object in ipairs(newMob:GetDescendants()) do
            if object:IsA("BasePart") then
                PhysicsService:SetPartCollisionGroup(object, "Mob")
            end
        end
        
        
        newMob.Humanoid.Died:Connect(function()
            task.wait(0.5)
            newMob:Destroy()
        end)
        
        coroutine.wrap(mob.Move)(newMob, map)
    end
else
    warn("Requested mob does not exist:", name)
end

end

return mob

#

@blissful tendon

tribal swift
#

ur using a deprecated method

#

use the new method

vale heron
#

@tribal swift

#

here the script

#

local PhysicsService = game:GetService("PhysicsService")
local ServerStorage = game:GetService("ServerStorage")
local mob = {}

function mob.Move(mob, map)
local humanoid = mob:WaitForChild("Humanoid")
local waypoints = workspace.Waypoints

for waypoint=1, #waypoints:GetChildren() do
    humanoid:MoveTo(waypoints[waypoint].Position)
    humanoid.MoveToFinished:Wait()
end

mob:Destroy()

end
function mob.Spawn(name, quanity, map)
local mobExists = ServerStorage.Mobs:FindFirstChild(name)

if mobExists then
    for i=1, quanity do
        task.wait(0.5)
        local newMob = mobExists:Clone()
        newMob.HumanoidRootPart.CFrame = map.Start.CFrame
        newMob.Parent = map.Mob
        newMob.HumanoidRootPart:SetNetworkOwner(nil)    
        
        for i, object in ipairs(newMob:GetDescendants()) do
            if object:IsA("BasePart") then
                PhysicsService.BasePart.CollisionGroup(object, "Mob")
            end
        end
        
        
        newMob.Humanoid.Died:Connect(function()
            task.wait(0.5)
            newMob:Destroy()
        end)
        
        coroutine.wrap(mob.Move)(newMob, map)
    end
else
    warn("Requested mob does not exist:", name)
end

end

return mob

tribal swift
#

are u trying to set the player and mob as the same collision group

#

is this some chatgpt ahh code

#

🗿