This script activated per click and the problem is that its create smoke on part that already has smoke. i found solution with local DefaultParticle = Instance.new("Smoke",DefaultPart) but i dont think thats its a right solution. First question how to check if part already has Smoke, second question is there any others better ideas how to do this?
If you want to check for smoke, you should loop through the part or entity you want to check with :GetDescendants(). then you can check if its a smoke with :IsA(“Smoke”)
Although this is Valid, when doing this, you can accidentally delete something which isn’t Intended
Mainly because you are looking to the Hierarchy within the Part for smoke, and can accidentally delete a Detail of some sort. (If i said that correctly)
I try a lot of things with it but nothing worked and smoke still spawns only in one part. I dont really understand how to do this because this helps me to find part with smoke but i need to find part without smoke and add it into this part.
Still dont really understand how to do it. I try it with “if not” and just “if” and etc but still have the same problem(on picture)
Maybe someone can say me where i need to place “FindFirstChildWhichIsA” and give me a quick-explanation why and where it need to stay? Here is my script:
local module = {}
module.Particle = function(opacity,risevelocity,size,timescale,color)
local player = game.Players.LocalPlayer
local char = player.Character
local DefaultPart = Instance.new("Part")
local DefaultParticle = Instance.new("Smoke")
local PartsHolder = game.Workspace.PartsHolder
DefaultPart.Name = "Default part"
DefaultPart.Transparency = 1
DefaultPart.CanCollide = false
DefaultPart.CanTouch = false
DefaultPart.Anchored = true
DefaultPart.Size = Vector3.new(0.645, 0.645, 0.645)
DefaultPart.Position = char.RightUpperLeg.Position
DefaultPart.Parent = workspace.PartsHolder
print("part was created")
DefaultParticle.Name = "Default particle"
DefaultParticle.Color = Color3.new(color)
DefaultParticle.Opacity = opacity
DefaultParticle.RiseVelocity = risevelocity
DefaultParticle.Size = size
DefaultParticle.TimeScale = timescale
DefaultParticle.Parent = game.Workspace.PartsHolder["Default part"]
print("particle was created")
wait(10)
DefaultPart:Destroy()
end
return module
Part and smoke spawning once per click and i dont understand how to do that smoke will spawn only on part that doesn`t have smoke in it