I am making a gun that you use in first person, but I don’t know how to make it so that the gun points where the camera is pointing.
This I how I tried to do it
Server Script
game.ReplicatedStorage.HoldAssaultRifleEvent.OnServerEvent:Connect(function(player, gun, cam, mouse)
player.CameraMode = Enum.CameraMode.LockFirstPerson
while wait() do
if cam ~= nil then
local char = player.Character
end
end
end)
Local Script
script.Parent.Equipped:Connect(function(mouse)
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
workspace.CurrentCamera.CFrame = player.Character.Head.CFrame
game.ReplicatedStorage.HoldAssaultRifleEvent:FireServer(gun, workspace.CurrentCamera, mouse)
end)