I’m trying to make it so that the player can only collide with some things but even with this code I still collide with the things that I don’t want to but I get no errors.
local Players = game:GetService("Players")
local PhysicsService = game:GetService("PhysicsService")
Players.PlayerAdded:Connect(function(player)
print("hi")
player.CharacterAdded:Connect(function(character)
print("bye")
for i, object in ipairs(character:GetDescendants()) do
if object:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(object, "Player")
end
end
end)
end)
I even have checks Hi and Bye and they both go through.
These are my collision groups.