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

How do I make an animation load?

Asked by 5 years ago

I am making a game, and I'm trying to make a sword, but my animations wont work. Yes, I tried being owner of team create and It's not a group game. Here's my script.

01local debounce = true
02 
03script.Parent.Activated:Connect(function()
04    if debounce == true then
05        debounce = false
06            local Anim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Animation)
07                Anim:Play()
08            script["Error Soul Sword Noise"]:Play()
09            wait(1)
10            debounce = true
11    end
12end)

Can someone help me fix it?

1 answer

Log in to vote
0
Answered by 5 years ago

I think you want it to play everytime you "fight" with the sword. 1. Create a Animation and a LocalScript inside of your tool (Not in your Handle) 2. Open your script and paste this in it:

1script.Parent.Equipped:Connect(function(Mouse) -- Detect If the Player is holding the Sword
2    Mouse.Button1Down:Connect(function() -- Detect If the Player clicked with the Sword
3local  animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation) --Find the animation
4        animation:Play() -- Plays the animation
5 
6end)
7end)
0
Won't Work KamKam_AJHasBeenBan 37 — 5y
0
This isn't a bad answer, as it works, but I don't think it's something that should be used for an extensive amount of time due to you constantly loading the animation per click. You also forget to disconnect your mouse function, leading to exponential event firings which lead to exponential animation loads, easily hitting the 256 animation cap. Fifkee 2017 — 5y
0
um. KamKam_AJHasBeenBan 37 — 5y
0
still wont work KamKam_AJHasBeenBan 37 — 5y
View all comments (2 more)
0
Hm. This is the same script I use for my things and it works :/. Maybe you made something wrong with your Animation ID or the export. DeAuroraxx 50 — 5y
0
I made a new animation KamKam_AJHasBeenBan 37 — 5y
Ad

Answer this question