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.
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!
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
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.
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.