im trying to make a viewmodel and when i try to run the animation through script, it refuses to run. any help is appreciated!
local player = game.Players.LocalPlayer
local char = player.Character
local cam = workspace.Camera
local run = game:GetService("RunService")
local arms = game.ReplicatedFirst.DeagleViewModel:Clone()
local MyGun = script.Parent
local GunHandle = MyGun:WaitForChild("Handle")
arms.Parent = cam
MyGun.Equipped:Connect(function()
local FPSARMS = game.Workspace.Camera:WaitForChild("DeagleViewModel")
FPSARMS.LeftArm.Transparency = 0
FPSARMS.RightArm.Transparency = 0
GunHandle.Transparency = 1
local Humanoid = arms.Humanoid
local Animation = arms.Animation
local LoadAni = Humanoid:LoadAnimation(Animation)
LoadAni:Play()
local GunModel = FPSARMS.Deagle:GetChildren()
for i, value2 in pairs(GunModel) do
value2.Transparency = 0
end
end)
if MyGun.Equipped then
arms.Parent = cam
run.RenderStepped:Connect(function()
arms:SetPrimaryPartCFrame(cam.CFrame * CFrame.new(1,-2,-2.5) * CFrame.Angles(0,0,0))
end)
end
MyGun.Unequipped:Connect(function()
arms.Parent = cam
local FPSARMS = game.Workspace.Camera:WaitForChild("DeagleViewModel")
FPSARMS.LeftArm.Transparency = 1
FPSARMS.RightArm.Transparency = 1
local GunModel = FPSARMS.Deagle:GetChildren()
for i, value in pairs(GunModel) do
value.Transparency = 1
end
end)