Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make arms and gun show in first person?

Asked by 5 years ago
Edited 5 years ago

Source I tried to use: https://scriptinghelpers.org/guides/the-first-person-element-of-a-first-person-shooter

So I have been trying to make a first person shooter and cant seem to understand how to make arms and gun appear like in Call Of Duty by attaching a rig into the camera. Are there any videos, links, ect. on how I could do this?

Script I tried to use to do this.

local camera = game.Workspace.CurrentCamera;
local humanoid = game.Players.LocalPlayer.CharacterAdded:Wait():WaitForChild("Humanoid");

local repWeapon = game.ReplicatedStorage:WaitForChild("Gun");

local weapon = repWeapon:Clone();
local viewModel = game.ReplicatedStorage:WaitForChild("viewModel"):Clone();

weapon.Parent = viewModel;
viewModel.Parent = camera;

local joint = Instance.new("Motor6D");
joint.C0 = CFrame.new(1, -1, -1);
joint.Part0 = viewModel.Head;
joint.Part1 = weapon.Handle;
joint.Parent = viewModel.Head;

print("Done!")

local function onDied()
    viewModel.Parent = nil;
end

local function onUpdate(dt)
    viewModel.Head.CFrame = camera.CFrame;
end

humanoid.Died:Connect(onDied);
game:GetService("RunService").RenderStepped:Connect(onUpdate);
0
well the thing looks fine Vortex_Vasne 89 — 5y
0
ok but I cant seem to be able to put the gun into the camera ReallyUnikatni 68 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

this is very complicated and probably too hard for your skill level for now just abandon this project your working on. this is probably not the answer your looking for but im being completely honest.

Ad

Answer this question