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.
01 | local debounce = true |
02 |
03 | script.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 |
12 | end ) |
Can someone help me fix it?
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:
1 | script.Parent.Equipped:Connect( function (Mouse) -- Detect If the Player is holding the Sword |
2 | Mouse.Button 1 Down:Connect( function () -- Detect If the Player clicked with the Sword |
3 | local animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation) --Find the animation |
4 | animation:Play() -- Plays the animation |
5 |
6 | end ) |
7 | end ) |