Answers for "how to turn off player collision in roblox"

Lua
1

how to turn off player collision in roblox

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

PhysicsService:CollisionGroupSetCollidable("Players", "Players", false)

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		repeat wait(1) until char:WaitForChild("Humanoid")
		
		for _, characterPart in pairs(char:GetChildren()) do
			if characterPart:IsA("BasePart") then
				PhysicsService:SetPartCollisionGroup(characterPart, "Players")
			end
		end
	end)
end)

-- Put this in "ServerScriptService"
-- Message me on discord Muppet#6931
Posted by: Guest on February-26-2021

Code answers related to "how to turn off player collision in roblox"

Browse Popular Code Answers by Language