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

How do u make it so players dont collide?

Asked by 4 years ago

can somebody please send a script because i really need help.please send in script format

2 answers

Log in to vote
0
Answered by
NotedAPI 810 Moderation Voter
4 years ago

Hello venprince,

There is actually an article made by Roblox relating this topic. This article can be found here https://developer.roblox.com/en-us/articles/Player-Player-Collisions

0
the roblox article dont work venprince -2 — 4y
0
yes it does u just have to try to read and understand coolmanHDMI 72 — 4y
Ad
Log in to vote
0
Answered by
jgftr7 74
4 years ago

This is what NotedAPI said but something that makes sense to your brain cells

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)

I AM NOT STEALING CREDIT PLEASE MAKE NOTEDAPI THE ANSWER

Answer this question