I wanted to learn about this service so I followed the developer hub and came up with the code that I here. The only problem is that is doesn't want to work at all. I have no idea what goes wrong because I get no errors. Help is very appreciated.????
local PhysicsService = game:GetService("PhysicsService")
-- Define parts
local part = game.Workspace.Part
local notCollide = game.Workspace.NotCollide
local collide = game.Workspace.Collide
-- Create group names
local obstacles = "Obstacles"
local greenObjects = "GreenObjects"
local partGroup = "Part"
-- Create the collision groups
PhysicsService:CreateCollisionGroup(obstacles)
PhysicsService:CreateCollisionGroup(greenObjects)
PhysicsService:CreateCollisionGroup(partGroup)
-- Add the object to the groups
PhysicsService:SetPartCollisionGroup(notCollide, obstacles)
PhysicsService:SetPartCollisionGroup(collide, greenObjects)
PhysicsService:CollisionGroupSetCollidable(obstacles, partGroup, false) -- Sets the collision of the part and the obstacle
--to be false
PhysicsService:CollisionGroupSetCollidable(greenObjects, partGroup, true) -- Sets the collision of the part and the obstacle
--to be true
