I’ve parented it to game.Workspace.CurrentCamera
Result:
Does it at least move around with your camera, if not, then something else must be wrong OR you still have your weld still inserted in there.
I suggest to parent the viewmodel to the player’s character and then set it’s CFrame to the player’s character HumanoidRootPart CFrame every RenderStepped…
It doesn’t move, I also removed the weld.
That’s not what he’s attempting to achieve, he’s trying to make an FPS viewmodel, not a 3rd Person one. Parenting to CurrentCamera and changing CFrames then will suffice.
Ok but FPS = FIRST PERSON shooter so he should set the first person and problem solved
Quick question. Does your Viewmodel have a PrimaryPart set? If not, try setting one, then, I recommend welding everything in the model to that PrimaryPart AND THEN, CFraming the Viewmodel.PrimaryPart in the RenderStepped update.
That’s not the problem, even if I did First Person for the camera, it doesn’t fix anything.
Okay, I’m going to try to make a PrimaryPart.
There’s a flaw in what you’re trying to get him to achieve, if you parent it to the Character, and it sets to First Person Mode, then his whole character goes invisible, that includes all descendants of the character.
That is, unless you make your own custom camera and set it’s CFrame accordingly to the character, but even then, that posts many more issues.
Maybe try taking it one step at a time. None of this code will work if your viewModel is not correctly parented and welded to the player correctly FIRST. Once you get that working, it will be a lot easier.
Can you explain how I would make a PrimaryPart?
On your model called “Viewmodel” you simply press the Property which says “PrimaryPart”, then click any part in the Viewmodel, preferably the Head and boom, you got yourself a PrimaryPart.
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]])
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);
Now try also adding the rotation I showed.