Flamethrower problem

Hello i was trying to make a flamethrower to where when you hold click a particle emitter comes out of the barrel of the flamethrower and i also want a value to go down every time your holding on it then i made a damage part to cover the emitter and when you touch you take 1 damage every second my problem is when i activate the weapon the flame a shows and goes away but not out of barrel it does it where i spawned the gun since the gun was a free model and i was just scripting it i have been getting this problem for a long time and had no idea on how to fix it

https://gyazo.com/7987a39f1f6bae2c581816b6d58ee9f1

that is a video of what happens the flame does not come out of barrel and the value is not going down

local heat = script.Parent:WaitForChild("Heat")

local barrel = script.Parent:WaitForChild("Barrel")

local plr = game.Players.LocalPlayer

local fire = script.Parent.Barrel:WaitForChild("Flame")

local character

local firing = false

local mouse = plr:GetMouse()

local damagehitbox = script.Parent.Barrel:WaitForChild("DamgeHitbox")

local  tool = script.Parent






plr.CharacterAdded:Connect(function(NewCharacter)
	character = NewCharacter
end)

character = plr.Character

while firing == true do
	heat.Value = heat.Value -1
end

tool.Activated:Connect(function()
	firing = true
	fire.Enabled = true
end)

tool.Deactivated:Connect(function()
	firing = false
	fire.Enabled = false
end)
1 Like

Hello,
The reason the “heat” value doesn’t go down is because the while loop is not in your Activated function, also, if you ran the while loop, it would crash anyways due to there not being any waits.
The fire particles are probably due to it not being welded to the gun itself, so you have to weld the part holding the ParticleEmitter to the flamethrower, and voila, particles.

3 Likes