--Trying to detect touch events when player collision is disabled my code:
enter code here
local PhysicsService = game:GetService("PhysicsService")
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:LoadCharacter() player.CharacterAdded:Connect(onCharacterAdded) end
Players.PlayerAdded:Connect(onPlayerAdded)
for i,v in pairs(Players:GetPlayers()) do v.Character.Humanoid.Touched:Connect(function() print(v.Character) --Does not print end) end`
Touched events should still work even if player collision is disabled(It did for me). If it does not then you can use Region3 and make a function that checks if a player is within in the region.