How do turn player collision off?

local PS = game:GetService("PhysicsService")
PS:CreateCollisionGroup("Player")
PS:CollisionGroupSetCollidable("Player","Player",false)

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		Character:WaitForChild("HumanoidRootPart")
		Character:WaitForChild("Head")
		Character:WaitForChild("Humanoid")
		for i,v in pairs(Character:GetChildren()) do
			if v:IsA("BasePart") then
				PS:SetPartCollisionGroup(v,"Player")
			end
		end
	end)
end)

This is my current script for and it does work when i play local but as soon as its a server it doesn’t work? Not sure why any help will be appreciated!

3 Likes

Try this code, and let me know if it works:

local PS = game:GetService("PhysicsService")
PS:CreateCollisionGroup("Player")
PS:CollisionGroupSetCollidable("Player","Player",false)

game.Players.PlayerAdded:Connect(function(Player)
	
for i,v in pairs(plr.Character:GetChildren()) do
			if v:IsA("BasePart") then
				PS:SetPartCollisionGroup(v,"Player")
			end
		end

Player.CharacterAppearanceLoaded:Connect(function(Character)
		for i,v in pairs(Character:GetChildren()) do
			if v:IsA("BasePart") then
				PS:SetPartCollisionGroup(v,"Player")
			end
		end
	end)
end)

(sorry for bad indentation)

1 Like

Doesn’t work! Also are these correct:

Those do not have anything to do with the collision, Have you tried making a collision group beforehand then in the game all you need to do is set the collision groups to the players.

Also when you test, click on one of the player’s parts and check if the collision group is applied to them.

So I ran my game and looked in the HumanoidRootPart and CanCollide is true. – I looked in all the parts not just HumanoidRootPart

I haven’t made a collision group beforehand.

You’re not checking for the cancollide… You are checking for it’s collision group…

And try making the collision group beforehand and setting the collisions there.

local PS = game:GetService("PhysicsService")
PS:CreateCollisionGroup("Player")

Does this create a collision group?

All parts in the player have the CollisiongroupId set to 0

Yes, that creates a collision group… I’m on about using the actual collision group editor in studioimage

Oh :sweat_smile: I Pressed it and do I have to change anything.

Yes, look up on how to use it, it’s better than creating collision groups in a script and stuff

2 Likes

Thanks, I looked into it and manged to fix player Collisions. I’m going to carry on looking at Collisions just so I understand it a bit more. Thanks :heart:

2 Likes

Hello there,

I will send you a script.

[CREATE A SCRIPT IN SERVICESCRIPTSERVICE] Script:

script.Parent = game:GetService("ServerScriptService")
local PhysService = game:GetService("PhysicsService")
local PlayerGroup = PhysService:CreateCollisionGroup("p")
PhysService:CollisionGroupSetCollidable("p","p",false)

function NoCollide(model)
for k,v in pairs(model:GetChildren()) do
	if v:IsA"BasePart" then
		PhysService:SetPartCollisionGroup(v,"p")
	end
end
end

game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
	char:WaitForChild("HumanoidRootPart")
	char:WaitForChild("Head")
	char:WaitForChild("Humanoid")
	wait(0.1)
	NoCollide(char)
end)

if player.Character then
	NoCollide(player.Character)
end
end)

Greetings,

Sys. (Aka. Tim)

11 Likes