For FPS, I’m not meant to be putting it on the character, it’s meant to only just be attached to the camera. I’m following this tutorial by EgoMoose: The First Person Element Of A First Person Shooter
And now I just weld viewModel.Head to the Right and Left Arm, and then doing viewModel:SetPrimaryPartCFrame(onUpdate)?
No, you weld Right and LeftArm to the HEAD, then you can update the CFrame also by doing this:
Viewmodel.PrimaryPart.CFrame = --// blah blah
As you mentioned, you can also do it like this:
Viewmodel:SetPrimaryPartCFrame(--[[blahblah]])
1 Like
It’s still laying on the ground. Also, this is my new code:
local camera = game.Workspace.CurrentCamera;
local character = game.Players.LocalPlayer.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid");
local viewModel = game.ReplicatedStorage:WaitForChild("viewModel"):Clone();
viewModel.Parent = character
viewModel.Head.CFrame = camera.CFrame * CFrame.Angles(0,math.pi, 0)
local rightArm = viewModel:WaitForChild("Right Arm")
local leftArm = viewModel:WaitForChild("Left Arm")
local weld = Instance.new("WeldConstraint")
weld.Part0 = leftArm
weld.Part1 = viewModel.Head
weld.Parent = leftArm
local weld2 = Instance.new("WeldConstraint")
weld2.Part0 = rightArm
weld2.Part1 = viewModel.Head
weld2.Parent = rightArm
local function onDied()
viewModel.Parent = nil;
end
local function onUpdate(dt)
viewModel:SetPrimaryCFrame(camera.CFrame)
end
humanoid.Died:Connect(onDied);
game:GetService("RunService").RenderStepped:Connect(onUpdate);
2 Likes
Now try also adding the rotation I showed.
2 Likes