Alright, I’ve kinda got 2 issues here.
- For some reason, no matter what, the doors in the game don’t register when touched by the bot, however, pretty much everything else does.
If the .Touched event were registering properly, the bot would’ve stopped, due to the fact that the door part has a child called “IsOpen” which is a boolValue.
The Script:
for _, v in pairs(script.Parent:GetDescendants()) do
if v:IsA("Part") or v:IsA("UnionOperation") or v:IsA("MeshPart") then
v.Touched:Connect(function(obj)
local isOpen = v:FindFirstChild("IsOpen")
if isOpen ~= nil then
script.Parent.Humanoid.WalkSpeed = 0
wait(2.5)
script.Parent.Humanoid.WalkSpeed = 10
end
end)
end
end
- I have the CanCollide property on the doors set to false so that the bot can pathfind through them, however, to combat players that may simply walk through all of the doors, I have set all of the doors to be in the same CollisionGroup, and then set the Player CollisionGroup to collide with the door collision group. However, this doesn’t work for some reason. Is this just something that Roblox can’t do?
The Script:
local PhysicsService = game:GetService("PhysicsService")
PhysicsService:CreateCollisionGroup("Players")
PhysicsService:CreateCollisionGroup("Door")
for _, v in pairs(game.Workspace:GetDescendants()) do
if v:FindFirstChild("IsOpen") ~= nil then
PhysicsService:SetPartCollisionGroup(v, "Door")
end
end
PhysicsService:CollisionGroupSetCollidable("Players", "Players", false)
PhysicsService:CollisionGroupSetCollidable("Players", "Door", true)
--The player's character is set to the "Players" CollisionGroup later, and I know for sure that works through other testing.
Anyone know what to do about either of these things?