I’m making a helmet and I want it to show good in first person, the problem is when the helmet is supposed to open, the viewmodel’s motor6d transform does not do anything at all (The viewmodel is unanchored)
The code I’m using for changing the Motor6D is this:
local h = game.ReplicatedStorage.Handle:Clone()
local camera = workspace.CurrentCamera
local head = game.Players.LocalPlayer.Character:WaitForChild("Head")
local function IsFirstPerson()
return (head.CFrame.p - camera.CFrame.p).Magnitude < 1
end
game:GetService("RunService").RenderStepped:Connect(function()
if IsFirstPerson() and head.Parent:FindFirstChild("Helmet") ~= nil then
h.Parent = workspace.CurrentCamera
h.CFrame = workspace.CurrentCamera.CFrame * CFrame.new(0.225,-0.2,-0.15)
h.HelmetMid.HelmetHighFrameM.Transform = head.Parent:FindFirstChild("Helmet").Handle.HelmetMid.HelmetHighFrameM.Transform --doesn't work for some reason
elseif not IsFirstPerson() then
h.Parent = game.Lighting
end
end)
The code here finds the player’s actual accessory and attempts to replicate the motor6d transform of the actual helmet.
Could anyone explain why doesn’t this work?
Thanks.