I do similar stuff using the A and D keys to sound horns on train locomotives. It's done from the vehicle seat. If you use a vehicle seat, you can use the throttle and steering to your advantage VERY easily, as long as its unanchored, and it will still work if it is welded to the ground. Let's say I want to sound a horn located inside the seat, when either A or D are held. (or LeftArrowKey or RightArrow Key) A and D change the steering values to -1 and 1. When neither are pressed the steer value is 0. So, when the value is 1 or -1, the horn will start sounding. When you release the key and it turns to 0, it stops sounding. Here's the script I use, on which you can make a few changes to work with your smoke:
while true do
wait(.0000000001)
if script.Parent.Steer == 1 or script.Parent.Steer == -1 then
script.Parent.Horn:Play()
elseif script.Parent.Steer == 0 then
script.Parent.Horn:Stop()
end
end
Just change the script.Parent.Horn:Play() to enable the smoke in a certain part, and script.Parent.Horn:Stop() to disable the smoke. Then as I hold down A, D, LeftArrowKey, or RightArrowKey, the smoke will do its thing. When none of those 4 are pressed, the smoke will stop. Just like my horn for my trains. If you would like me to make the smoker for you, just tell me either here, or on ROBLOX, however the best way to contact me is to shoot me an email at DieselElevators@Gmail.com and just tell me it's you. I'll be more than happy to make it for you.
1 comment
You can't use quotes in a boolean. (Also, you can refer to the player as game.Players.LocalPlayer)