I have made a localscript that toggles the cancollide property but it only works once
I think you should start experimenting with collision groups.
The article I linked does a really good job at explaining how it works.
can you give me a code example to get me started?
The article has plenty code examples?
This question seems to have been already asked, so maybe you can go check through the answers and find one that’ll work for you
Where can i get the collision group editor?
local character = game.Players.LocalPlayer.Character
local physics = game:GetService('PhysicsService')
physics:CreateCollisionGroup("Object")
physics:SetPartCollisionGroup(your part here, "Object")
physics:SetPartCollisionGroup(character, "Object")
physics:CollisionGroupSetCollidable("Object", "Object", false)
(Didn’t test this yet.)
In studio, go to the MODEL tab, and on the far right you will see the Collision Group button, click that to open up the editor
when the object gets destroyed is it auto removed from the collision group?
i want to make it so the player can go through the obstacle but the other parts cannot
Yes, also why would it matter if it still was in the collision group?
Try this code:
local character = game.Players.LocalPlayer.Character
local physics = game:GetService('PhysicsService')
physics:CreateCollisionGroup("Object")
physics:SetPartCollisionGroup(your part here, "Object")
physics:SetPartCollisionGroup(character, "Object")
physics:CollisionGroupSetCollidable("Object", "Object", false)
because my code clones the parts every 5 sec so idk there to be error