Ctrl + shift + F to search for keywords inside every script
it works now, except i changed the delay time to 15 seconds and it also makes the smoke stay this long, causing lag.
script:
local ready = true
local sound = script.Parent.Sound–Change to your sound location.
local delaytime = 15
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
coroutine.wrap(function()
local part = v
part.Anchored = false
local smoke = Instance.new(“Smoke”)
smoke.Parent = v
smoke.Color = Color3.new(197, 196, 199)
smoke.Opacity = 0.25
smoke.RiseVelocity = 6
wait(15)
print(“UnColliding Part”)
part.CanCollide = false
end)()
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)
You may have to also put that in a coroutine itself try this
local ready = true
local sound = script.Parent.Sound--Change to your sound location.
local delaytime = 15
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
coroutine.wrap(function()
local part = v
part.Anchored = false
local smoke = Instance.new("Smoke")
smoke.Parent = v
smoke.Color = Color3.new(197, 196, 199)
smoke.Opacity = 0.25
smoke.RiseVelocity = 6
wait(15)
print("UnColliding Part")
part.CanCollide = false
end)()
end
sound:Stop()
sound:Play()
coroutine.wrap(function()
wait(5)
for i, v in pairs(script.Parent.Parent:GetChildren()) do
if v:IsA("BasePart") then
v.Smoke:Destroy()
end
end
end)()
wait(delaytime) -- Amount of till making smoke dissapear
script:Destroy()
ready = true
end
end)
I’m not sure how optimal this is but it should do the tric. It puts that code in its own thread so it waits 5 seconds and then gets rid of all the smokes without disrupting the other parts of the script
tysm @Wyzloc and @EmbatTheHybrid for helping me fix this, for any future people checking this thread: my solution to the original problem was i parented one of the parts wrong causing it to see workshop as a parent, through the topic we also fixed other problems we encountered such as: not unanchoring, not uncollidable, smoke staying, lagg.
final ** working ** script:
local sound = script.Parent.Sound--Change to your sound location.
local delaytime = 15
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
coroutine.wrap(function()
local part = v
part.Anchored = false
local smoke = Instance.new("Smoke")
smoke.Parent = v
smoke.Color = Color3.new(197, 196, 199)
smoke.Opacity = 0.25
smoke.RiseVelocity = 6
wait(15)
print("UnColliding Part")
part.CanCollide = false
end)()
end
sound:Stop()
sound:Play()
coroutine.wrap(function()
wait(5)
for i, v in pairs(script.Parent.Parent:GetChildren()) do
if v:IsA("BasePart") then
v.Smoke:Destroy()
end
end
end)()
wait(delaytime) -- Amount of till making smoke dissapear
script:Destroy()
ready = true
end
end)```
You may have to fix the formatting a bit
Here’s the formatted code for the people to see
local ready = true
local sound = script.Parent.Sound--Change to your sound location.
local delaytime = 15
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
coroutine.wrap(function()
local part = v
part.Anchored = false
local smoke = Instance.new("Smoke")
smoke.Parent = v
smoke.Color = Color3.new(197, 196, 199)
smoke.Opacity = 0.25
smoke.RiseVelocity = 6
wait(15)
print("UnColliding Part")
part.CanCollide = false
end)()
end
sound:Stop()
sound:Play()
coroutine.wrap(function()
wait(5)
for i, v in pairs(script.Parent.Parent:GetChildren()) do
if v:IsA("BasePart") then
v.Smoke:Destroy()
end
end
end)()
wait(delaytime) -- Amount of till making smoke dissapear
script:Destroy()
ready = true
end
end)
whats the code symbol thingy for this, ill edit my post
It’s on the top left of most keyboards, it has the ~ key with it on the keycap
It should be with the ~ key, just look around on your key board to find it, it’s generally on the top right or above the enter key
That’s good! If you have anymore issues don’t be afraid to make another post!
‘’‘test’‘’
‘’‘does this work?’‘’
im editing this
where is that symbol on the keyboard
~`
found it