Help with PhysicsService

Can anyone help with my code

local Players = game:GetService("Players")
local Physics = game:GetService("PhysicsService")
Physics:CollisionGroupSetCollidable("Players", "Players", false)

local function NoCollide(character)
	for i, v in pairs(character:GetChildren()) do
		if v:IsA("BasePart") then
			Physics:RegisterCollisionGroup(v, "Players")
			v.CollisionGroup = "Players"
		end
	end
end

Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		NoCollide(character)
	end)
end)

Im basically wanting a script where players cant collide. However its not working

Note: Ive already set the collison group up in the Collisions tab

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

PS:RegisterCollisionGroup("Player")
PS:CollisionGroupSetCollidable("Player", "Player", false)

local function assignPlayerCollisionGroup(char:Model?)
	char:WaitForChild("HumanoidRootPart")
	char:WaitForChild("Head")
	char:WaitForChild("Humanoid")

	for i, v:Instance in pairs(char:GetDescendants()) do
		if v:IsA("BasePart") then
			v.CollisionGroup = "Player"
		end
	end
end

Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAppearanceLoaded:Connect(function(char)
		assignPlayerCollisionGroup(char)
	end)
end)

Is this the better way? because it looks that way

The only change is probably this:

I took this from one of my games so this should work.

ah okay thank you sm. ill set it to solved

1 Like

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