Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Did roblox break character Collision?

Asked by 5 years ago

Did ROBLOX break something to do with physics? Cause this simple script to remove player collision is not working in online mode. Works in an 8 player test server and solo though.

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

local playerCollisionGroupName = "Players"
PhysicsService:CreateCollisionGroup(playerCollisionGroupName)
PhysicsService:CollisionGroupSetCollidable(playerCollisionGroupName, playerCollisionGroupName, false)

Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Character)
        for _,child in pairs(Character:GetDescendants()) do
            if child:IsA("BasePart") then
                PhysicsService:SetPartCollisionGroup(child, playerCollisionGroupName)
            end
        end
    end)
end)

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

im not sure abt ur script but i would recommend u used a roblox - made script designed for this before u can judge whether roblox broke its stuff:

taken from wiki:

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

local playerCollisionGroupName = "Players"
PhysicsService:CreateCollisionGroup(playerCollisionGroupName)
PhysicsService:CollisionGroupSetCollidable(playerCollisionGroupName, playerCollisionGroupName, false)

local previousCollisionGroups = {}

local function setCollisionGroup(object)
  if object:IsA("BasePart") then
    previousCollisionGroups[object] = object.CollisionGroupId
    PhysicsService:SetPartCollisionGroup(object, playerCollisionGroupName)
  end
end

local function setCollisionGroupRecursive(object)
  setCollisionGroup(object)

  for _, child in ipairs(object:GetChildren()) do
    setCollisionGroupRecursive(child)
  end
end

local function resetCollisionGroup(object)
  local previousCollisionGroupId = previousCollisionGroups[object]
  if not previousCollisionGroupId then return end 

  local previousCollisionGroupName = PhysicsService:GetCollisionGroupName(previousCollisionGroupId)
  if not previousCollisionGroupName then return end

  PhysicsService:SetPartCollisionGroup(object, previousCollisionGroupName)
  previousCollisionGroups[object] = nil
end

local function onCharacterAdded(character)
  setCollisionGroupRecursive(character)

  character.DescendantAdded:Connect(setCollisionGroup)
  character.DescendantRemoving:Connect(resetCollisionGroup)
end

local function onPlayerAdded(player)
  player.CharacterAdded:Connect(onCharacterAdded)
end

Players.PlayerAdded:Connect(onPlayerAdded)
0
also i swear there is an option in humanoids that lets u choose if u want them to collide? TheluaBanana 946 — 5y
Ad

Answer this question