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: