Basically, I tried to make a script to remove player collision and uh, I dunno how I screwed this up.
Script:
local player = game.Players.LocalPlayer
game.Players.PlayerAdded:Connect(function(player)
if player:WaitForChild("Character") then
player.Character.Torso.CanCollide = false
player.Character.HumanoidRootPart.CanCollide = false
player.Character.Head.CanCollide = false
end
end)
local PhysService = game:GetService('PhysicsService')
local PlayerGroup = PhysService:CreateCollisionGroup('Player')
PhysService:CollisionGroupSetCollidable('Player','Player',false)
function NoCollide(Player)
for k,v in pairs (Player:GetChildren()) do
if v:IsA('BasePart') then
PhysService:SetPartCollisionGroup(v,'Player')
end
end
end
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
NoCollide(Character)
end)
if Player.Character then NoCollide(Player.Character) end
end)
function NoCollide(Player)
for k,v in pairs (Player:GetChildren()) do
if v:IsA('BasePart') then
PhysService:SetPartCollisionGroup(v,'Player')
end
end
end
local function disableCollision(obj)
if obj:IsA(‘BasePart’) then
PhysicsService:SetPartCollisionGroup(obj, ‘Players’)
end
end
local function setup(model)
for i, obj in pairs(model:GetDescendants()) do
disableCollision(obj)
end
model.DescendantAdded:connect(function(obj)
disableCollision(obj)
end)
end
game:GetService(‘Players’).PlayerAdded:connect(function(player)
if player.Character then
setup(player.Character)
end
player.CharacterAdded:connect(function(char)
setup(char)
end)
end)
Certain parts of the character are forced to have CanCollide set to true, no matter how much you try to set it otherwise. Like others said, the best way to disable player collision is to use collision groups.