Hello Developers,
I was recently working on an FPS game, and I have finished most of my framework. I created animations for guns which you can check out here. The animations are somewhat done (I revamped them today), when I realized I need an aiming system. I couldn’t figure out how I would do that, as there are no tutorials on youtube or the devforum either.
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
local camera = workspace.CurrentCamera
mouse.Button1Down:Connect(function()
camera.FieldOfView = 50 --Any number you choose
end)
mouse.Button1Up:Connect(function()
camera.FieldOfView = 70 --Default I believe
end)
local brr = Cframe.new(x,y,z)
userinputservice:rightclick
brr=Cframe.new(aiming cframe)
else
brr=Cframe.new()
end
runservice loop or smth similar
gun:pivotto(CurrentCam.Cframe*brr)
end
I dont know how your framework runs so Im not able to provide anything copy and paste obvi, this is just how it would go. Cframes and stuff for more