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

How you make a ViewModel display a tool?

Asked by 4 years ago
Edited 4 years ago

I was looking at the fps guide on here, but my gun doesnt show up. I dont know if the gun isnt attached or what.

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

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

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);

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

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

local joint = Instance.new("Motor6D");
joint.C0 = CFrame.new(1, -1.5, -2); -- what I found fit best
joint.Part0 = viewModel.Head;
joint.Part1 = weapon.Handle;
joint.Parent = viewModel.Head;
0
I wish I could explain more but I made the rig, the viewModel is in repstorage, idek ReallyUnikatni 68 — 4y
0
and what the actual hell is a viewmodel... Igoralexeymarengobr 365 — 4y
0
look in the first step to an fps guide on here ReallyUnikatni 68 — 4y
0
its basically fake arms for when in first person ReallyUnikatni 68 — 4y

Answer this question