I’m trying to make players not collide with eachother when one is supposed to be invisible to others (in this instance they are in the character creator which is a physical location that they all take up together) but they are always colliding with each other no matter what, as if they are ignoring the CollisionGroupSetCollidable() functions completely
Script in ServerScriptService, print statements work:
local players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PhysicsService = game:GetService("PhysicsService")
PhysicsService:RegisterCollisionGroup("NoCollide")
PhysicsService:RegisterCollisionGroup("Player")
PhysicsService:CollisionGroupSetCollidable("NoCollide", "NoCollide", false)
PhysicsService:CollisionGroupSetCollidable("Player", "NoCollide", false)
PhysicsService:CollisionGroupSetCollidable("Player", "Default", true)
players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
repeat task.wait(0.1) until char:WaitForChild("Humanoid")
for i, part in pairs(char:GetDescendants()) do
if part:IsA("BasePart") then
part.CollisionGroup = "NoCollide"
end
end
end)
end)
ReplicatedStorage.ToggleCollision.OnServerEvent:Connect(function(player, x)
local char = player.Character
for i, part in pairs(char:GetDescendants()) do
if part:IsA("BasePart") then
if x then
print("on")
part.CollisionGroup = "Player"
else
print("off")
part.CollisionGroup = "NoCollde"
end
end
end
end)
LocalScript is just simple ReplicatedStorage.ToggleCollision:FireServer(true)
(and false)