Night Vision: Animation Issue

LocalScript

local UserInputService = game:GetService("UserInputService")
local LocalPlayer = game:GetService("Players").LocalPlayer
local PlayerScript = LocalPlayer.PlayerScripts

local Character = script.Parent

local Lighting = game.Lighting.OutdoorAmbient
local NV = PlayerScript:WaitForChild("NV")
local NUser = PlayerScript:WaitForChild("NVUser")

local Anim1 = Instance.new("Animation", Character)
Anim1.AnimationId = "rbxassetid://15314671576"
local Anim2 = Instance.new("Animation", Character)
Anim2.AnimationId = "rbxassetid://15314675328"

local Anim1Track = Character.Humanoid:LoadAnimation(Anim1)
local Anim2Track = Character.Humanoid:LoadAnimation(Anim2)

UserInputService.InputBegan:Connect(function(input, processed)
	if processed then return end
	if NUser.Value == true then
		if input.KeyCode == Enum.KeyCode.N then
			if NV.Value == false then
				NV.Value = true
				Anim2Track:Play()
				game.Lighting.OutdoorAmbient = Color3.fromRGB(255,255,255)
				game.Lighting.ColorCorrection.Enabled = true
			else
				if NV.Value == true then
					NV.Value = false
					Anim1Track:Play()
					game.Lighting.OutdoorAmbient = Lighting
					game.Lighting.ColorCorrection.Enabled = false
				end
			end
		end
	end
end)

My problem with this script is that it works fine but the problem I believe is with Motor6D, because of what I wanted to happen, is the following. The animations make the player use his hand to raise the goggles and then the goggles would be raised. The problem is that after the animation, the goggles go back to their original animation and don’t stay up. I was wondering how to resolve this issue?

Very surely, it’s about Motor6D, if someone can help me, please help.

If anyone can respond, please do.

1 Like