the script below does this: if you touch one brick in a model group all bricks in that group become unanchored, i was wondering if it were possible that if it did the same but also: make every part emit smoke for a few seconds? so touch one brick in group, all bricks become unanchored all bricks emit smoke for a sec
function OnTouch(part)
h = part.Parent:FindFirstChild("Humanoid")
if h then
for i,v in pairs(script.Parent.Parent:GetChildren()) do
v.Anchored = false
end
end
end
script.Parent.Touched:Connect(OnTouch)
That is not the complete code, sadly, but itās a (really really basic) piece of code you can tamper with to fit your needs. Itās more to give you an idea of what you need to do.
The code would also fit into the āfor i,v in pairsā loop.
for i,v in pairs(script.Parent.Parent:GetChildren()) do
v.Anchored = false
local smoke = Instance.new("Smoke")
smoke.Parent = v
end
local function emitSmoke()
for i, v in pairs(script.Parent.Parent:GetChildren()) do
v.Ancored = false
local smoke = Instance.new("Smoke")
smoke.Parent = v
smoke.Color = Color3.new(0, 0, 0)
smoke.Opacity = 0.15
smoke.RiseVelocity = 4
smoke.Size = v / 4
end
wait(5) -- Amount of till making smoke dissapear
for i, v in pairs(script.Parent.Parent:GetChildren()) do
v.Smoke:Destroy()
end
end
Have you connected the .Touched event to the code? If so, put in a print statement in a few lines of the code, like the for loop and the beginning of the code block.