Hello so I have this monster and I have this door and I have myself.
My monster chases the players and I got all that down however when the player is behind a door the monster isnt able to reach them
Hello so I have this monster and I have this door and I have myself.
My monster chases the players and I got all that down however when the player is behind a door the monster isnt able to reach them
You want to make it so where the Killer can go through doors to find players?
I want it so that the killer doesnt consider doors as objects and makes paths through them. The monster is able to walk through the door but the pathfinding thinks it cant
So, basically Noclip type shi?
the monster already noclips through the doors but doesnt actually ever go through it cause it considers them as obstacles and refuses to walk through them. I am asking how do I make the monster ignore doors and just create paths through them
use PhysicsService
local ps = game:GetService("PhysicsService") -- getting the service
ps:CreateCollisionGroup("NPCGroup") -- creating a group for doors
ps:CreateCollisionGroup("DoorsGroup") -- creating a group to the npc
ps:CollisionGroupSetCollidable("NPCGroup","DoorsGroup", false) -- making them cant collide
local NPC = "put here your npc"
for i,v in pairs(workspace:GetDescendants()) do
if v.Name == "Door" then -- put this name in every door in your game
ps:SetPartCollisionGroup(v,"DoorsGroup")
end
end
for _,v in pairs(NPC:GetDescendants()) do
if v:IsA("BasePart") then
ps:SetPartCollisionGroup(v,"NPCGroup")
end
end
I already have a script for physics service and thats not what I asked. I asked how do I make a monster not consider my door to be an obstacle? even if an object is cancollide the pathfinding still considers it to be an obstacle. I tried using a path modifier with walk through but it doesnt work. Do I have to configure the monster or something.
this is my collisions script:
local playerObstacleCollisionGroupName = "PlayerObstacleCollisionGroup"
local monsterCollisionGroupName = "MonsterCollisionGroup"
game:GetService("PhysicsService"):RegisterCollisionGroup(playerObstacleCollisionGroupName)
game:GetService("PhysicsService"):RegisterCollisionGroup(monsterCollisionGroupName)
game:GetService("PhysicsService"):CollisionGroupSetCollidable(playerObstacleCollisionGroupName, monsterCollisionGroupName, false)
local obstacles = workspace.Obstacles:GetDescendants()
for _, obstacle in ipairs(obstacles) do
if obstacle:IsA("BasePart") then
obstacle.CollisionGroup = playerObstacleCollisionGroupName
end
end
for _, obstacle in ipairs(workspace.Prompts:GetDescendants()) do
if obstacle:IsA("BasePart") then
obstacle.CollisionGroup = playerObstacleCollisionGroupName
end
end
game.Players.PlayerAdded:Connect(function(player)
local character = player.Character or player.CharacterAdded:Wait()
character:WaitForChild("HumanoidRootPart")
local parts = character:GetDescendants()
for _, part in ipairs(parts) do
if part:IsA("BasePart") then
part.CollisionGroup = playerObstacleCollisionGroupName
end
end
end)
for i,v in pairs(script.Parent:GetDescendants()) do
if v:IsA("BasePart") then
v.CollisionGroup = monsterCollisionGroupName
end
end
and yes the entire door model is inside of the obstacles folder in workspace
This might be what you’re looking for
I don’t know if there are any events that could do this but I found something that might help. Have you tried setting it to CanCollide = false
and sending a remove event to all client which makes all the doors locally CanCollide = true
?
Ah. There’s actually something that does this: Character Pathfinding | Roblox Creator Documentation
First you need to anchor and set the CanCollide property to false of the part to you want to ignore, in your case, the door. Second, you need to insert a PathFindingModifier
instance inside the part. Set the PassThrough
property of the PathFindingModifier
you added earlier. Now when you recompute the path, it will now ignore the door and walk through it.
the solution was I needed to add the modifier’s label to the param costs
script.Parent.CanCollide = false
Done.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.