#Equip animation is glitching.

1 messages · Page 1 of 1 (latest)

true frost
#

Hello! I need help with my view model script. When I pull out the gun, sometimes it double plays or just glitches, especially on the first one or when you switch to another gun. Please dm to help me fix this or not dm just interact with this. The script is around 200-300 words long but I think I know which part causes the error.

stable wren
#

send part you think

#

causes the error

true frost
#

local function onToolEquipped(tool)
if not tool:IsA("Tool") then return end
currentTool = tool
equipped = true
isAiming = false
currentAimBlend = 0
local toolItemId = tool:GetAttribute("_ItemId") or tool.Name

setPlayerArmsTransparency(ARMS_TRANSPARENCY_WHEN_EQUIPPED)

local viewModel = createViewModel(toolItemId)

if viewModel then
    local config = getWeaponConfig(toolItemId)
    camera.FieldOfView = config.regularFOV
    ammotext.Enabled = true

    -- Play animations immediately after viewmodel creation
    playEquipAnimation()
end

end

local function onToolUnequipped()
equipped = false
currentTool = nil
isAiming = false
cleanupViewModel()
setPlayerArmsTransparency(0)
local tween = TweenService:Create(camera, TweenInfo.new(0.25, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out), {FieldOfView = DEFAULT_REGULAR_FOV})
tween:Play()
currentAimBlend = 0
ammotext.Enabled = false
end