so I tried scripting this script and put it inside a gun tool since my gun just needs some realistic feels (smoke appears when you shoot).
somehow when I shoot with my gun the smoke doesn't appear.
the script:
1 | local Tool = script.Parent |
2 |
3 | Tool.Equipped:Connect( function (Mouse) |
4 | Mouse.Button 1 Down:Connect( function () |
5 | Instance.new( "Smoke" , script.Parent.Handle) |
6 | wait( 2 ) |
7 | script.Parent.Handle.Smoke:Destroy() |
8 | end ) |
9 | end ) |
I'm pretty new at scripting so I mostly got the script from a roblox wiki tutorial and just edited it.
it is a normal script and is inside the tool.
Use Activated()
That all you need to change
1 | local Tool = script.Parent |
2 |
3 | Tool.Activated:Connect( function () |
4 | Instance.new( "Smoke" , script.Parent.Handle) |
5 | wait( 2 ) |
6 | script.Parent.Handle.Smoke:Destroy() |
7 | end ) |
More about Tool
Try adding a position, smoke particles need a position for the emitter, and you didn't specify the position, so try doing this:
01 | local Tool = script.Parent |
02 |
03 | Tool.Equipped:Connect( function (Mouse) |
04 | Mouse.Button 1 Down:Connect( function () |
05 | local smoke = Instance.new( "Smoke" , script.Parent.Handle) |
06 | smoke.Position = script.Parent.Handle.Position |
07 | wait( 2 ) |
08 | script.Parent.Handle.Smoke:Destroy() |
09 | end ) |
10 | end ) |
Hope I could help!