Viewmodel arms appearing in the wrong place

Earlier, my viewmodel was working fine a few hours ago. I replaced the model of arms as well as the animation, with no change to the code and now it does not appear on the screen, instead it appears someplace on the baseplate. Keep in the mind the animation is playing.

Here is what looks like in game:

This is the code that I currently use to handle the viewmodel.

local Primary = "AKM"
local currentgun = nil
local uis = game:GetService("UserInputService")
local renderstepped = game:GetService("RunService").RenderStepped
local currentcamera = game.Workspace.CurrentCamera

local function equip(gun)
	if currentgun ~= gun then
		currentgun = gun
		print(gun)
		local gun = game.ReplicatedStorage.Viewmodels[gun]:Clone()
		gun.Parent = game.Workspace.CurrentCamera
		gun.Name = "Arms"
		
		
		
		-- animations start
		
		local idle = gun.Animation:LoadAnimation(gun.Idle)
		idle:Play()
		
		-- animations end
	end
end

equip(Primary)





renderstepped:Connect(function()
	if currentcamera:FindFirstChild("Arms") then
		currentcamera.Arms:SetPrimaryPartCFrame(currentcamera.CFrame)
	end
end)
    

If anybody could help it would be greatly appreciated!

Have you renamed the viewmodel?

Your code never says if there isn’t something called “Arms” in the camera, so this check could be causing no sort of indication of what’s going on. I suggest you change it to:

if currentcamera:FindFirstChild("Arms") then
	currentcamera.Arms:SetPrimaryPartCFrame(currentcamera.CFrame)
else
	warn("There's nothing called 'Arms' in the camera!")
end

and check the output

When I am in the game, it is parented to the camera and it is named Arms.

image

After putting the warn I suggested, is there anything the output?

After I did that, no there is not.

Have you tried replacing :SetPrimaryPartCFrame with :PivotTo?

1 Like

Thank you for that suggestion. I changed it now but now it stuffed up the game.

It displays the model, which is a start, but with a few draw backs…

By the looks of it, it sets your camera to that exact spot where it appeared before (I think?)

The baseplate is also moving with the character.

Can you show what’s inside the Arms model?

All the motor6d’s are for animating.

Are you sure that you haven’t accidentally put the wrong parts in the model? Check through all the parts inside of the Arms model.

What do you mean by the “wrong parts”?

Eg; you accidentally misclicked and moved the Baseplate into the model, because that’s literally the only way this can be happening if the only code in your game is the script you sent.

There is other code in the game, they have nothing to do with this though. No parts in the model should not be there.

What about welds/Motor6Ds? Maybe you’ve accidentally welded the Baseplate to a part in the viewmodel. Search “motor6d” in the Explorer, and look for any incorrect welds.

1 Like

I had an unknown weld to my baseplate, oops!

Thank you for your help, I really appreciate it. Will be marking your answer as the solution.

Have a good rest of your day/night! :slight_smile:

1 Like