UserInputService.InputBegan:Connect(function(InputObject, GameHandledEvent)
if GameHandledEvent or not ExpectingInput then return end
if InputObject.UserInputType == Enum.UserInputType.MouseButton1 or InputObject.UserInputType == Enum.UserInputType.Gamepad1 then
MouseEvent:FireServer(GetMouseDirection(InputObject.Position))
end
end)
did you try replacing GetMouseDirection(InputObject.Position) with (mouse.Hit.p - handle.Position).unit
if you haven’t already, put a reference for mouse and handle which mouse is the player mouse, and handle is the gun’s handle (what you are holding)
aaaaaaaaaaaa thanks! It worked when I removed the GetMouseDirection function and added the mouse pos - the hand pos!
Thanks so much!
UserInputService.InputBegan:Connect(function(InputObject, GameHandledEvent)
if GameHandledEvent or not ExpectingInput then return end
if InputObject.UserInputType == Enum.UserInputType.MouseButton1 or InputObject.KeyCode == Enum.KeyCode.ButtonR2 then
local FireDirection = (Mouse.Hit.Position - Handle.Position).Unit
MouseEvent:FireServer(FireDirection)
end
end)