Hi so recently I've been experimenting with the camera and so I scripted a gun to the camera. I honestly don't know how to make it shoot. Any help would be nice!
The video I watched: https://www.youtube.com/watch?v=T_uMjXoU8YQ
The framework code:
local player = game.Players.LocalPlayer
local cam = workspace.CurrentCamera
local mouse = player:GetMouse()
local rep = game:GetService("ReplicatedStorage")
local gun = rep.Guns.G36C
local run = game:GetService("RunService")
for i,v in pairs(gun:GetChildren()) do
if v:IsA("BasePart") then
if v ~= gun.PrimaryPart then
local weld = Instance.new("Weld")
weld.Part0 = gun.PrimaryPart
weld.Part1 = v
weld.C0 = gun.PrimaryPart.CFrame:inverse()
weld.C1 = v.CFrame:inverse()
weld.Name = v.Name
weld.Parent = gun.PrimaryPart
end
end
end
gun.Parent = cam
run.RenderStepped:connect(function()
gun:SetPrimaryPartCFrame(cam.CFrame*CFrame.new(0,-1.1,.2))
end)
I would like to make it shoot! THANKS!

1 comment
Any help works!