can u please help
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local uis = game:GetService("UserInputService")
local runserv = game:GetService("RunService")
local cam = game.Workspace.CurrentCamera
local aim = CFrame.new()
local isAiming
local weaponsystem = {
inv = {"AK12/76"};
model = nil;
}
function loadSlot(i)
local weaponsFolder = game.ReplicatedStorage.Weapons
weaponsystem.model = weaponsFolder:FindFirstChild(i):Clone()
weaponsystem.model.Name = "equippedweapon"
weaponsystem.model.Parent = game.Workspace
end
loadSlot(weaponsystem.inv[1])
runserv.PreRender:Connect(function()
local v = game.Workspace.equippedweapon
v:SetPrimaryPartCFrame(cam.CFrame * aim)
if isAiming and weaponsystem.model ~= nil then
--local offset = weaponsystem.model["AK12/76"].Model.Parts["Cylinder.005"].CFrame:ToObjectSpace(weaponsystem.model.PrimaryPart.CFrame)
local offset = weaponsystem.model["AK12/76"].Model.Parts.Aimpoint.CFrame:ToObjectSpace(weaponsystem.model.PrimaryPart.CFrame)
aim = aim:Lerp(offset, .15)
else
local offset = CFrame.new()
aim = aim:Lerp(offset, .15)
end
end)
uis.InputBegan:Connect(function(inp)
if inp.UserInputType == Enum.UserInputType.MouseButton2 then
print("aiming")
isAiming = true
end
end)
uis.InputEnded:Connect(function(inp)
if inp.UserInputType == Enum.UserInputType.MouseButton2 then
print("aiming ended")
isAiming = false
end
end)

