You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
What i want to achieve is to make a pathfinding npc be able to kick down doors
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried to use raycasting to do it, but however, i cant seem to make the npc be able to kick down doors
1 Like
You could try a pathfinding modifier label to activate the door kick function.
This is what I used once to make a NPC open the door.
for _, waypoint in pairs(waypoints) do
if waypoint.Label == "Open" then
local overlapParams = OverlapParams.new()
overlapParams.FilterType = Enum.RaycastFilterType.Exclude
overlapParams.FilterDescendantsInstances = {NPC}
local place = workspace:GetPartBoundsInRadius(NPC.PrimaryPart.CFrame.Position,6,overlapParams)
for i, v in place do
if v.Name == "OpenDoorA" or v.Name == "OpenDoorB" then
local base = v.Parent.Base
local hinge = base.Parent.Doorframe.Hinge
local prompt = base.ProximityPrompt
local goalOpen = {}
goalOpen.CFrame = hinge.CFrame * CFrame.Angles(0, math.rad(90), 0)
local goalClose = {}
goalClose.CFrame = hinge.CFrame * CFrame.Angles(0, 0, 0)
local tweenInfo = TweenInfo.new(1)
local tweenOpen = TweenService:Create(hinge, tweenInfo, goalOpen)
local tweenClose = TweenService:Create(hinge, tweenInfo, goalClose)
if prompt.ActionText == "Open" then
print("Open")
tweenOpen:Play()
prompt.ActionText = "Close"
v.Parent:SetAttribute("Open",true)
base.CanCollide = false
base.Union.CanCollide = false
elseif prompt.ActionText == "Close" then
print("Close")
tweenOpen:Play()
prompt.ActionText = "Open"
v.Parent:SetAttribute("Open",false)
base.CanCollide = true
base.Union.CanCollide = true
end
end
end
end
NPC.Humanoid:MoveTo(waypoint.Position)
3 Likes
It seems to not work, i see that you are using a populer e to open door model from toolbox.However,
It will not work
1 Like
Did you enable the passthrough on the pathfinding modifier? And yes was a quick door to test.
And as I remember I did have to put the modifier in a part in front of the door on the floor so the pathfinding could see it.
1 Like
yes i have put the pathfinding mod in the door