How does one Put a gun in the camera and make it follow mouse without messing with the character? (Used to weld the gun to the head and put it in Camera)
I'm assuming that your gun is just a model and not a tool. However if it is a tool, you should model everything together and then put the model outside of the tool and delete the tool instance.
When you are left with just your model, make sure there is a primarypart
. Then put the model in replicatedstorage
in a folder.
Make sure you have removed all other manual welds and other Weld Scripts.
We then want to put a local script
in StarterCharacterScripts
Which is a sub catagory of StarterPlayer
.
In our script it will look like this:
local cam = workspace.CurrentCamera local RepS = game:GetService("ReplicatedStorage") local RunS = game:GetService("RunService") local model = RepS:WaitForChild("Model"):Clone() for i,v in pairs (model:GetChildren()) do if v:IsA("BasePart") then if v ~= model.PrimaryPart then local weld = Instance.new("Weld") weld.Part0 = model.PrimaryPart weld.Part1 = v weld.C0 = model.PrimaryPart.CFrame:inverse() weld.C1 = v.CFrame:inverse() weld.Name = v.Name weld.Parent = model.PrimaryPart end end end model.Parent = cam RunS.RenderStepped:Connect(function() model:SetPrimaryPartCFrame(cam.CFrame*CFrame.new(-2,-2,-2)) end)
I wrote this on phone so I cannot guarantee that this will work