Hi, I think I'm doing something wrong here. But heres a short explanation on what I intended this to do, as a player you can spawn in as a ghost (thats unneeded) but then make it so that you as a player are able to go through the ghost and the ghost can go through you, here is what I've made so far and It's not working;
Inside a module script;
local ps = game:GetService("PhysicsService")
ps:CreateCollisionGroup("player")
ps:CreateCollisionGroup("ghost")
ps:CollisionGroupSetCollidable("ghost", "player", false)
ps:CollisionGroupSetCollidable("ghost", "ghost", false)
function module:RemoveCollisions(model)
for a,b in pairs(model:GetChildren()) do
if b:IsA("BasePart") then
ps:SetPartCollisionGroup(b, "ghost")
end
end
end
function module:Ghosting(char)
char:WaitForChild("HumanoidRootPart")
char:WaitForChild("Head")
char:WaitForChild("Humanoid")
wait(0.1)
module:RemoveCollisions(char)
end
Inside a server script in ServerScriptService
remotes.ChangeRole.OnServerEvent:Connect(function(plr, char, changerole)
if changerole == "Ghost" then
local role = require(game.ReplicatedStorage.Roles.Ghost)
role:Ghosting(char) -- this fires the Ghosting function in the module script
end
end)
Any help would be greatly appreciated, thank you so much for your time on reading my concerns.

3 comments
I don't quite understand what you mean by 'Make sure you add all players to the "player" group, and those who become ghosts you can set them to the "ghost" group.' are you able to elaborate and give a answer in lua? Edited my question to show what I've done so far
Thanks very much, will try out the code soon. Just going out now.
Note my second edit was written from scratch and is not a solid replacement for yours. It is simply showing my explanation of adding all the players who spawn to one collision group, and to ghost them you add them to another