Hello I am making a gun
there is one localscript inside of the gun tool and I know that I must use a remote event and a server script but for now I will just use one localscript until the gun will work.
So my problem is that the bullet of the gun use a BodyGyro and a BodyVelocity The BodyGyro works but I just can’t set the BodyVelocity because I want it to go where the player’s mouse is targeting
and when I test the gun the bullets go only in one direction
this is the current script (inside the tool):
Debounce = true
plr = game.Players.LocalPlayer
Bullet = game.ReplicatedStorage.Bullet
script.Parent.Activated:Connect(function(fire)
if Debounce == true then
Debounce = false
wait()
local char = plr.Character
local Mouse = plr:GetMouse()
local pos = char.Humanoid.TargetPoint
local LookAt = pos - char.Head.Position
script.Parent.AK:Play()
local NBullet = Bullet:Clone()
NBullet.Parent = script.Parent
NBullet.Position = script.Parent.BulletP.Position
NBullet.BodyGyro.CFrame = Mouse.Hit
NBullet.BodyVelocity.Force = Mouse.Hit.p
print(Mouse.Hit.p)
wait()
Debounce = true
end
end)
someone please help
(oh and if you need any more informations just ask me)