Im currently making a realistic shooting game and I want to make it add up the tilt amount with the mouse delta.x but it get snappy
local RunService = game:GetService("RunService"); local UserInputSerice = game:GetService("UserInputService"); local UserGameSettings = game:GetService("UserGameSettings")
local Players = game.Players; local LocalPlayer = Players.LocalPlayer; local Character = LocalPlayer.Character; local Humanoid = Character:FindFirstChildWhichIsA("Humanoid")
local HumanoidRootPart = Character.HumanoidRootPart
local ReplicateStorage = game.ReplicatedStorage; local GunAnimation = ReplicateStorage.GunAnimation; local GunModel = ReplicateStorage.GunModel
local Loadout = require(Character.Loadout)
local cam = game.Workspace.CurrentCamera
local GunViewmodel
local sway = CFrame.new()
local handmoverad = 0.3
local function Equip(changecurrentslot)
GunViewmodel = GunModel:FindFirstChild(Loadout.slot[changecurrentslot]).Model:clone()
GunViewmodel.Parent = cam
end
local function UnEquip(changecurrentslot)
end
RunService.RenderStepped:Connect(function(dt)
local Delta = UserInputSerice:GetMouseDelta()
sway = CFrame.new(sway.X + Delta.X / 555, sway.Y - Delta.Y / 555, 0) * CFrame.Angles(0, 0, sway.Z - Delta.X / 100)
--sway = CFrame.new(math.clamp(sway.X, -handmoverad, handmoverad), math.clamp(sway.Y, -handmoverad, handmoverad), 0)
GunViewmodel.FakeCamera.CFrame = cam.CFrame * sway
end)
Equip("1")