Make parts group cancollide: off

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear! i want the parts group (model.part.script.) i want the all the parts in the group to become walkthroughable (cancollide off) after 25 sec or so

  2. What is the issue? Include screenshots / videos if possible! see script below, (doesnt work)

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? i tried different scripts but nothing worked

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

script.Parent.Touched:Connect(function()
	wait(25)
	script.Parent.Parent:GetChildren() do
		PhysicalProperties:cancollide = false
	end
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

You shouldn’t use touched events, as exploiters can activate them.

The way you would make CanCollide false in all parts in a model is this simple:

model = -- the model
for i,v in pairs(model:GetDescendants()) do
     if v:IsA("BasePart") then
          v.CanCollide = false
     end
end

and where do i put the wait() and does this cancollide false all parts of the group the parts in? because all my models are basically named model

You should have separate names for all of your models so you can access them in scripts. The script I put immediately makes CanCollide false for all parts/meshparts in a model. You could put a wait() before, but you definitely should use something other than .Touched to activate it. You could possibly use raycasts or .Magnitude.

well, i dont mind exploiters accesing or triggering it since its just the way that if u touch something it breaks, if they wish to break something more easily then so be it… is there a way my script can still be used?

I’d suggest learning some scripting from the wiki, it’s a very helpful resource and it’s how I learned to script over time.

script.Parent.Touched:Connect(function()
	wait(25)
	for i,v in pairs(script.Parent.Parent.GetDescendants()) do
          if v:IsA("BasePart") then
               v.CanCollide = false
          end
     end
end)
1 Like

it for some reason doesnt work. maybe its because i also have this script inside the part? should it be in the same script?

local ready = true
local sound = script.Parent.Sound–Change to your sound location.
local delaytime = 5
script.Parent.Touched:Connect(function()
if ready == true then
ready = false
for i, v in pairs(script.Parent.Parent:GetChildren()) do
if not v:IsA(“BasePart”) then continue end
v.Anchored = false
local smoke = Instance.new(“Smoke”)
smoke.Parent = v
smoke.Color = Color3.new(197, 196, 199)
smoke.Opacity = 0.25
smoke.RiseVelocity = 6
end
sound:Stop()
sound:Play()

	wait(delaytime) -- Amount of till making smoke dissapear
	
	for i, v in pairs(script.Parent.Parent:GetChildren()) do
		if v:IsA("BasePart") then
			v.Smoke:Destroy()
		end
	end
	script:Destroy()
	ready = true
end

end)

	wait(delaytime) -- Amount of till making smoke dissapear
	
	for i, v in pairs(script.Parent.Parent:GetChildren()) do
		if v:IsA("BasePart") and v:FindFirstChild("Smoke") then -- check to see if the part has smoke
			v.Smoke:Destroy()
		end
	end
	script:Destroy()
	ready = true
end

what did you just send me? it looks like just the end of the script