Hello!
I have a gun script which shoots out bullets which are supposed to shoot in the direction of the mousepos.
local RS = game:GetService("ReplicatedStorage")
local RunS = game:GetService("RunService")
local Velocity = 250
local Time
local Gravity = workspace.Gravity
RunS.Heartbeat:Connect(function(dt)
Time = dt
end)
RS.Events.Gunshot_Event.OnServerEvent:Connect(function(Player,GunName,MouseShotPosition,GunModel)
local Axis = MouseShotPosition
local Bullet = game.ReplicatedStorage.GunVFX.Bullet:Clone()
Bullet.Parent = workspace.GameFolders.Bullets
Bullet.CFrame = GunModel.Barrel.CFrame
local S = Velocity*Time
local s = Time-((1/2)*Gravity*(Time*Time))
Bullet.AssemblyLinearVelocity = Vector3.new(0,s,S)
end)
Right now, all its doing right now is falling into the void, which isnt what I want.
How would I make it move and also go to the direction of the mousepos?
Thanks.