-
I am trying to achieve a viewmodel script but I have encountered an issue.
-
The issue here is that the viewmodel for some reason is upside down.
-
I have tried looking for solutions on the devforum but I couldn’t find anything, I tried to fix it myself before but couldn’t find a solution.
Here is my viewmodel script:
local RS = game:GetService("RunService")
local cam = workspace.CurrentCamera
local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local char = game.Players.LocalPlayer.Character
local hum = char.Humanoid
local viewmodel = game.ReplicatedStorage.Viewmodels.SCPs.SCP3114FP:Clone()
viewmodel.Name = "SCPviewmodel"
viewmodel.Parent = cam
local animator = viewmodel.AnimationController:WaitForChild("Animator")
local idleanim = script:WaitForChild("IdleAnim")
local idle = animator:LoadAnimation(idleanim)
cam.CameraSubject = plr.Character:WaitForChild("Humanoid")
hum.Died:Connect(function()
viewmodel:Destroy()
end)
local offset = CFrame.new(0, 0, -1.5)
RS.RenderStepped:Connect(function(dt)
viewmodel:PivotTo(
cam.CFrame * offset
)
end)
--loop variables
local idleuse = true
idle:Play()