Try setting Looped in the properties to true.
If doing the Handle.Loop:Play() broke your gun it means something else you did was wrong because playing a sound shouldnât be able to break anything. Unless thereâs something in the handle called loop that isnât a sound so it errors and breaks the gun. All you have to do is check the console for any errors.
Try renaming the Sound just for testing. Iâd also recommend stopping the sound if you stopped shooting flames. May you could tell us if there are any errors in the output if activated?
Try this and firstly locate the Handle instance:
local Tool = script.Parent
local Handle = ?
local LoopSound = Handle.Loop
local activated = 0
local deactivated = 0
function OnActivated()
LoopSound:Play()
script.Parent.Configurations.Active.Value = true
activated = os.time()
Tool.Shoot.Fire.Enabled = true
Tool.Shoot.Smoke.Enabled = true
for i = 1,10 do
Tool.Shoot.Transparency = 1-i/10
wait()
end
end
function OnDeactivated()
LoopSound:Stop()
script.Parent.Configurations.Active.Value = false
deactivated = os.time()
local totaltimeactive = deactivated-activated
if totaltimeactive < 1 then
totaltimeactive = 1
end
Tool.Shoot.Fire.Enabled = false
Tool.Shoot.Smoke.Enabled = false
print(totaltimeactive/2)
Tool.Shoot.AfterSmoke.Enabled = true
wait(totaltimeactive/2)
Tool.Shoot.AfterSmoke.Enabled = false
for i = 1,100 do
Tool.Shoot.Transparency = i/100
wait()
end
end
Tool.Activated:connect(OnActivated)
Tool.Deactivated:connect(OnDeactivated)
I Tried what u gaveme, it didnt work and my flamethrower stop shooting fire , so i changed the audio name to replay and changed loop to replay in the lua, but it said this for both attempts
12:13:01.474 Players.Ayd3nL.Backpack.Flamethrower.Main:7: attempt to index nil with âReplayâ - Server - Main:7
12:13:01.474 Stack Begin - Studio
12:13:01.474 Script âPlayers.Ayd3nL.Backpack.Flamethrower.Mainâ, Line 7 - function OnActivated - Studio - Main:7
12:13:01.474 Stack End - Studio
12:13:01.641 Players.Ayd3nL.Backpack.Flamethrower.Main:20: attempt to index nil with âReplayâ - Server - Main:20
12:13:01.641 Stack Begin - Studio
12:13:01.641 Script âPlayers.Ayd3nL.Backpack.Flamethrower.Mainâ, Line 20 - function OnDeactivated - Studio - Main:20
12:13:01.641 Stack End - Studio