Trying to make my own gun system, but how would I detect what way the gun should shoot?
No matter what, it only shoots one way: https://gyazo.com/c15a2f0ce8f67c17ae694f77b88a8c2c - Which is Z, because that’s the one I have it set as currently, but how would I detect which way it’d need to go?
This is my current code:
Gun script
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
script.Parent.Equipped:Connect(function(tool)
tool.Button1Down:Connect(function()
local bullet = script.Bullet:Clone()
bullet.Parent = workspace
bullet.Position = mouse.Hit.p --script.Parent.Handle.Position
bullet.Anchored = false
wait(5)
bullet:Destroy()
end)
end)