Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

LoadAnimtion is not a valid member of Humanoid?

Asked by 2 years ago

So I am trying to make a gun script, and I keep getting this same error "LoadAnimtion is not a valid member of Humanoid" what can I do to fix this?!?

Script :

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

local Tool = script.Parent
local FirePosition = Tool.Barrel.FirePoint
local MuzzleFlash = Tool.MuzzleFlash
local PointLight = MuzzleFlash.PointLight
local Decal1 = MuzzleFlash.Decal1
local Decal = MuzzleFlash.Decal

--//ANIMATIONS\\--
-- .AnimationId = "rbxassetid://" --

local EquipAnim = Instance.new("Animation",Humanoid)
EquipAnim.AnimationId = "rbxassetid://7532156999"
Humanoid:LoadAnimtion(EquipAnim)

local IdleAnim = Instance.new("Animation",Humanoid)
IdleAnim.AnimationId = "rbxassetid://7532122198"
Humanoid:LoadAnimtion(IdleAnim)

local Inspect = Instance.new("Animation",Humanoid)
Inspect.AnimationId = "rbxassetid://"
Humanoid:LoadAnimtion(Inspect)

local RecoildAnim = Instance.new("Animation",Humanoid)
RecoildAnim.AnimationId = "rbxassetid://7532109351"
Humanoid:LoadAnimtion(RecoildAnim)

local ReloadAnim = Instance.new("Animation",Humanoid)
ReloadAnim.AnimationId = "rbxassetid://"
Humanoid:LoadAnimtion(ReloadAnim)

--//SOUNDS\\--

local ReloadSound = Tool.Handle.ReloadSound
local ShootSound = Tool.Handle.ShootSound

--//DEBOUNCE\\--

local debounce = false

--//SETTINGS\\--

local Ammo = 60
local Mag = 120

local Cooldown = 0.05

local Damage = 35

--// SCRIPT \\--


   Tool.Equipped:Connect(function()

    EquipAnim:Play()
    wait(1)
    IdleAnim:Play()
    EquipAnim:Stop()

Mouse.Button1Down:Connect(function()
    PointLight.Enabled = true
    Decal.Transparency = 0
    Decal1.Transparency = 0
    ShootSound:Play()

     RecoildAnim:Play()
    IdleAnim:Stop()

    wait(0.1)

    PointLight.Enabled = false
    Decal.Transparency = 1
    Decal1.Transparency = 1
    RecoildAnim:Stop()
    IdleAnim:Play()
    end)
end)

2 answers

Log in to vote
0
Answered by 2 years ago

LoadAnimation is deprecated. You can read more about it here: https://developer.roblox.com/en-us/api-reference/function/Humanoid/LoadAnimation

0
Thank you! MrStati_c 2 — 2y
Ad
Log in to vote
0
Answered by 2 years ago

It's :LoadAnimation() not LoadAnimtion()

You simply spelled it wrong

Correction to the guy above : :LoadAnimation() is not deprecated, you just have to LoadAnimation on the Animator object inside Humanoid instead of loading it to the humanoid,

You can technically still LoadAnimation to the humanoid, but it's recommended you use the new method, roblox only allowed the old method because disabling it would ruin many games

Answer this question