I’m trying to make a door that only certain people can go through, similar to PhysicsService/Collision Filtering, however it seems that it only works for BaseParts.
Is there anything similar to those features that would work on Players and/or Characters?
Try making something like a whitelist system
Make a table that a players username would be added too when they are whitelisted. Thats all scripting without using physicsservice
Thankfully, I already have that portion of the script. Unfortunately, the issue now is letting those whitelisted individuals actually pass through the door.
local PhysicsService = game:GetService("PhysicsService")
local Players = game:GetService("Players")
local playersgroup = "Players"
local doors = "Doors"
PhysicsService:CreateCollisionGroup(playersgroup)
PhysicsService:CreateCollisionGroup(doors)
game:GetService("Players").PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
for i, v in pairs(char:GetChildren()) do
PhysicsService:SetPartCollisionGroup(v, playersgroup)
end
end)
end)
PhysicsService:CollisionGroupSetCollidable(playersgroup, doors, false)
Make an if conditional for the .PlayerAdded to whatever you want like:
game:GetService("Players").PlayerAdded:Connect(function(plr)
if plr.Name = "Urname"
And set the doors collision group to doors, I assume you know how to do those stuff.
Many thanks!!! Your script worked flawlessly. I included a simple conditional and some SetPartCollisionGroups() – [Not sure if that part was necessary but I thought I might as well include it]. Now the wall filters amongst qualified/non-qualified people perfectly. Weirdly, this “error” comes up in the output, but it just seems to be irrelevant.
Oh, must be getting a non basepart from the character, you can fix this by doing:
game:GetService("Players").PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
for i, v in pairs(char:GetChildren()) do
if v:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(v, playersgroup)
end
end
end)
end)