I am helping to develop an event which has a large quantity of people moving at the same time. I made a collision filter, which changed the cancollide value if a player was in a group or owned a gamepass. I received the error that the player was a datamodel, or something related to that. I could only replicate it in the server where there was a lot of people joining. I need help asap, my code is down here:
local physics = game:GetService("PhysicsService") local Players = game:GetService("Players") local GamePassService = game:GetService('MarketplaceService') local gamePassForcefield = game.Workspace.GroupDoorModel.GamePassDoor local gamePassForceFields = "GamePass" local hasGamePass = "gamePassPlayers" local GamePassId = 6318668 physics:CreateCollisionGroup(gamePassForceFields) physics:CreateCollisionGroup(hasGamePass) physics:SetPartCollisionGroup(gamePassForcefield, gamePassForceFields) physics:CollisionGroupSetCollidable(gamePassForceFields, hasGamePass, false) local function setCollisionGroupRecursive(object, groupName) if object:IsA("BasePart") then physics:SetPartCollisionGroup(object, groupName) end for _, child in ipairs(object:GetChildren()) do setCollisionGroupRecursive(child, groupName) end end local function onCharacterAdded(character) local player = game.Players:GetPlayerFromCharacter(character) if GamePassService:UserOwnsGamePassAsync(player.userId, GamePassId) or player:GetRankInGroup(4837748) == 3 or player:GetRankInGroup(4837748) > 5 then local collisionGroupName = hasGamePass setCollisionGroupRecursive(character, collisionGroupName) end end local function onPlayerAdded(player) player.CharacterAdded:Connect(function(character) onCharacterAdded(character) end) end Players.PlayerAdded:Connect(onPlayerAdded)
I do not care about optimization at this time, just getting it to work.