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

Help on How to Make a First Person Viewmodel?

Asked by
yelsew 205 Moderation Voter
8 years ago

By viewmodel, I mean a model of your arms and legs and torso that is viewable in first person. Here is my code if you see something wrong. It does iterate through the code, I just never see any parts. (the scale is so you can see it without it glitching the textures on both out) And this is a local script, so I can use the camera part. I have tried a few things to try and get it to work, but it seems like nothing changes it much.

local camera = game.Workspace.CurrentCamera
local model = Instance.new("Model", camera)
local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character
model.Name = "FirstPersonBody"

local rightarm = character:FindFirstChild("Right Arm"):Clone()
local leftarm = character:FindFirstChild("Left Arm"):Clone()
local rightleg = character:FindFirstChild("Right Leg"):Clone()
local leftleg = character:FindFirstChild("Left Leg"):Clone()
local torso = character.Torso:Clone()
local head = character.Head:Clone()

head.Transparency = 1
local humanoid = Instance.new("Humanoid", model)
humanoid.DisplayDistanceType = "None"
humanoid.MaxHealth = 0


local rightarmweld = Instance.new("Weld", character["Right Arm"])
local leftarmweld = Instance.new("Weld", character["Left Arm"])
local rightlegweld = Instance.new("Weld", character["Right Leg"])
local leftlegweld = Instance.new("Weld", character["Left Leg"])
local torsoweld = Instance.new("Weld", character["Torso"])
local headweld = Instance.new("Weld", character["Head"])

rightarmweld.Part0 = rightarmweld.Parent
leftarmweld.Part0 = leftarmweld.Parent
rightlegweld.Part0 = rightlegweld.Parent
leftlegweld.Part0 = leftlegweld.Parent
torsoweld.Part0 = torsoweld.Parent
headweld.Part0 = headweld.Parent

rightarmweld.Part1 = rightarm
leftarmweld.Part1 = leftarm
rightlegweld.Part1 = rightleg
leftlegweld.Part1 = leftleg
torsoweld.Part1 = torso
headweld.Part1 = head

local rightarmmesh = Instance.new("BlockMesh", rightarm)
local leftarmmesh = Instance.new("BlockMesh", leftarm)
local rightlegmesh = Instance.new("BlockMesh", rightleg)
local leftlegmesh = Instance.new("BlockMesh", leftleg)
local torsomesh = Instance.new("BlockMesh", torso)

rightarmmesh.Scale = Vector3.new(0.99, 0.99, 0.99)
leftarmmesh.Scale = Vector3.new(0.99, 0.99, 0.99)
rightlegmesh.Scale = Vector3.new(0.99, 0.99, 0.99)
leftlegmesh.Scale = Vector3.new(0.99, 0.99, 0.99)
torsomesh.Scale = Vector3.new(0.99, 0.99, 0.99)

rightarm.Parent = model
leftarm.Parent = model
rightleg.Parent = model
leftleg.Parent = model
torso.Parent = model
head.Parent = model

Answer this question