Flare from Flaregun not moving

I’m attempting to make a flaregun fire in the direction the player has their mouse, and have it slow down as it goes on. Currently, the flaregun fires, but the flare just falls to the ground.


I want it to act similar to a rocket launcher, but it slows down.
Serverscript:

local tool = script.Parent
local flarebase = game:GetService("ServerStorage").Flaregun.Flare
local flare
local handle = tool.Handle

local enabled = tool.Enabled
local debounce = false

tool.Use.OnServerEvent:Connect(function(plr,m)
	if debounce == false then
		enabled = false
		debounce = true
		print(m)

		flare = flarebase:Clone()
		flare.Parent = game:GetService("Workspace")
		flare.CFrame = CFrame.new(handle.Position,m)

		local velocity = Instance.new("LinearVelocity", flare)
		velocity.VectorVelocity = CFrame.new(flare.Position,m).LookVector * 300

		flare["Flare Gun"]:Play()
		flare["Flaregun Fire"]:Play()
		task.wait(0.25)
		flare.ParticleEmitter.Enabled = true
		velocity.VectorVelocity = CFrame.new(flare.Position,m).LookVector * 200
		task.wait(3)
		flare.ParticleEmitter.Enabled = false
		flare.PointLight.Brightness = 4
		velocity.VectorVelocity = CFrame.new(flare.Position,m).LookVector * 100
		task.wait(2)
		flare:Destroy()
		task.wait(1)

		debounce = false
		enabled = true
	end
end)

Localscript:

script.Parent.Equipped:Connect(function(m)
	m.Button1Down:Connect(function()
		if script.Parent.Enabled == true then
			script.Parent.Use:FireServer(m.Hit.Position)
		end
	end)
end)

Logs from the print statements:

There a topic of how to create a rocket launcher, it may help you, I’ll look for it right away

I need it to fire in a straight direction, not a homing shot

Then change the script to satisfy your needs

try just adding velocity to the flare by using Vector3.yAxis*100 yes the velocity property is deprecated but it still works pretty well imo

I forgot to set an attachment to the flare, but after setting the Attachment0, it works!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.