Trying to get Players to Not Collide with Eachother

I’ve been trying to get my players not to collide with each other, but every time I do, it gives this warning + the script doesn’t work.

BEFORE REPLY: Yes, my scripts to disable player collision are using Basepart.CollisionGroup. Or atleast I believe they are. The “SetPartCollisionGroup” that the warning is referring to isn’t even in the script. The warning only shows up when i use the test feature on roblox studio

Here is the code I’m using. It’s in serverscriptservice. Note: This is code from the official roblox documentation on collision filtering, which is what confuses me.

local PhysicsService = game:GetService("PhysicsService")
local Players = game:GetService("Players")

PhysicsService:RegisterCollisionGroup("Characters")
PhysicsService:CollisionGroupSetCollidable("Characters", "Characters", false)

local function onDescendantAdded(descendant)
	-- Set collision group for any part descendant
	if descendant:IsA("BasePart") then
		descendant.CollisionGroup = "Characters"
	end
end

local function onCharacterAdded(character)
	-- Process existing and new descendants for physics setup
	for _, descendant in pairs(character:GetDescendants()) do
		onDescendantAdded(descendant)
	end
	character.DescendantAdded:Connect(onDescendantAdded)
end

Players.PlayerAdded:Connect(function(player)
	-- Detect when the player's character is added
	player.CharacterAdded:Connect(onCharacterAdded)
end)

I’ve tried a lot of different scripts, but all seem to give the same error message. Anyone know any solutions that work to disable player colliding with eachother?

Edit: i tested out the script in another place, and it works perfectly fine. now i am much more confused on why it doesn’t even work on this place.

3 Likes

nevermind. of course it was from another script that was causing this issue. im dumb

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.