I am using this kit > https://devforum.roblox.com/t/simple-sandbox-tycoon-kit/1488280 for a sandbox tycoon game like Miners Haven.
So, I want ores to not hit each other, so like a cancollide. But obviously they need to be anchored so they wont fall through the map and delete. So how do I make the ores not collide with players or themselves?
Use collision groups.
local PhysicsService = game:GetService("PhysicsService") --Create the collision groups. PhysicsService:CreateCollisionGroup("Players") PhysicsService:CreateCollisionGroup("Ore") --Add the BaseParts in every player's character to the collision group "Players". game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) for i, part in pairs(character:GetDescendants()) do if part:IsA("BasePart") then PhysicsService:SetPartCollisionGroup(part,"Players") end end end) end) --Make players not collide with ores, and ores not collide with ores. PhysicsService:CollisionGroupSetCollidable("Players","Ore",false) PhysicsService:CollisionGroupSetCollidable("Ore","Ore",false)
and then use this when the ore is spawned:
--Add the ore to the collision group "Ore". PhysicsService:SetPartCollisionGroup(Ore,"Ore")
where Ore (the variable, not the string) is the ore that spawned.
Here is an article that explains it: https://developer.roblox.com/en-us/articles/Collision-Filtering