I am trying to make players not collide with each other, and I'm new to collision groups. Some reason, when I have a script run, in the game it is just gone, no where to be found. I don't understand why, but if I do a local server test and paste it into the server all the output says is "Could not create collision group"

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:GetService("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)

4 comments

0

You put the script in the ServerScriptService, on line 1.

0

I have tried putting it in Workspace and ServerScriptServer, it always goes away no matter what.

0

Save exit and reload studio. That can sometimes do it,., #roblox

0

Unfortunately not :/