I tried to make a script that inserts a part and if you click it, particles come out then the error says 'then' expected near ','. If anyone can help me, thank you.
x = Instance.new("Part", workspace)
c = Instance.new("ClickDetector", x)
c.Parent = game.Workspace.x
function onTouched(click)
function toGood(obj)
if i, v in pairs(obj:getChildren()) do
if v:IsA("BasePart") then
local p = Instance.new("ParticleEmitter", v)
p.Texture = ""
p.Rate = 5000
p.Lifetime = NumberRange.new(5)
p.VelocitySpread = NumberRange.new(100)
p.Speed = NumberRange.new(5000)
p.Size = NumberSequence.new(50)
end
toGood(v)
end
end
c.Parent.Touched:connect(onTouched)
toGood(workspace)

1 comment
Thanks sir, I highly appreciate your help. :D