I’m trying to make an aiming system for my rifle without a “viewmodel”, but the problem is that I do not know any technics for it. I’ve tried some ways to do it with “CFrames” which sort of didn’t work out because the rifle wouldn’t follow the camera’s mouse and instead just lock.
This is an example of the ADS I made which didn’t really worked out:
local Aim_Connection = nil
Mouse.Button2Down:Connect(function()
if game.Workspace:FindFirstChild(Player.Name):FindFirstChild(Weapon_Tool_Value.Value.Name) then
local Aim_Part = Handle.Weapon_Parts.Weapon_Slide_Part
if Aim_Part then
Weapon_Aiming = true
Camera.CameraType = Enum.CameraType.Scriptable
Aim_Connection = game:GetService("RunService").RenderStepped:Connect(function()
Camera.CFrame = CFrame.new(Aim_Part.Position) * Aim_Part.CFrame.Rotation * CFrame.new(0, 0.1, -0.3)
end)
end
end
end)
Mouse.Button2Up:Connect(function()
if game.Workspace:FindFirstChild(Player.Name):FindFirstChild(Weapon_Tool_Value.Value.Name) then
if Weapon_Aiming then
Weapon_Aiming = false
if Aim_Connection then
Aim_Connection:Disconnect()
Aim_Connection = nil
end
Camera.CameraType = Camera.CameraType
end
end
end)