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

Why isn't this script working? its says Idle is not a valid member

Asked by 2 years ago
local LocalCharacter = script.Parent
local Animate = LocalCharacter:FindFirstChild("Animate")

do

    LocalCharacter.Animate.Idle.Animation1.AnimationId = "http://www.roblox.com/asset/?id=7391593289"
    LocalCharacter.Animate.Idle.Animation2.AnimationId = "http://www.roblox.com/asset/?id=7391593289"

end

1 answer

Log in to vote
0
Answered by 2 years ago

There's no context but there's no veriable that's called Idle. I also don't suggest putting the numbers in the script. For the knife I made I made four classesname.Animation's 1st was hit, 2nd was Idle, 3rd was left slash, and 4rth was right slash. So you're gonna wanna put the animations in the tool not in the handle.

local plr = game:GetService("Players").LocalPlayer
local anims = {script.Parent.Animation1, script.Parent.Animation2}
local loadedAnims = {}
local tool = script.Parent
local animator


 tool.Equipped:Connect(function(mouse)
    animator = plr.Character:WaitForChild("Humanoid"):WaitForChild("Animator")
    if not loadedAnims[1] then
        loadedAnims[1] = animator:LoadAnimation(anims[1]) 
    end
    loadedAnims[1]:Play()

end)
tool.Unequipped:Connect(function()
    loadedAnims[1]:Stop()
end

Put the animation priority to action so it can be used on a tool. Haven't tested it just the Idle yet but I hope this works for you!

0
Make sure it's a local script too. darkkitten12345 8 — 2y
0
So the reason is because the script didn't know what Idle was and you needed to play the animation on equipped not just do. darkkitten12345 8 — 2y
0
you see the local script is in starter player script and the idle is supposed to work with or without the tool, but i think ill try to use your anime variable to fix my script Icy_limxz 14 — 2y
Ad

Answer this question