How to get this sword script working?
Okay, this is from a video that I watched by Stickmasterluke. It hasn't been working for me, and I copied every letter, space, and detail that he did. I need help with this. I know what the script does, I just don't know how to make one on my own. The issue is the activation. I'm trying to get the animations to play, which are in a different script, but it's deciding to not go like it's suppose to. I know it's the main script, not the animations.
Anyways, the script.
02 | handle = tool:WaitForChild( 'Handle' ) |
03 | event = tool:WaitForChild( 'RemoteEvent' ) |
13 | handle.Touched:connect( function (hit) |
14 | if equipped and humanoid and humanoid.Health > 0 and hit and not hit:isDescendantOf(character) and hit.Parent.Enemy then |
15 | local targethumanoid = hit.Parent:FindFirstChild( 'Humanoid' ) |
16 | if targethumanoid and targethumanoid.Health > 0 and not hithumanoid [ targethumanoid ] then |
17 | targethumanoid:TakeDamage(damage*combo) |
18 | hithumanoid [ targethumanoid ] = true |
23 | tool.Activated:connect( function () |
25 | local clickdelta = tick() - lastclick |
26 | if clickdelta > swingtime then |
29 | if clickdelta < swingtime + combowindow then |
30 | combo = (combo + 1 ) % 3 |
36 | event:FireClient(player, 'RunAnimation' , 'Slash' ) |
37 | elseif combo = = 1 then |
38 | event:FireClient(player, 'RunAnimation' , 'Spin' ) |
39 | elseif combo = = 2 then |
40 | event:FireClient(player, 'RunAnimation' , 'Slam' ) |
46 | tool.Equipped:connect( function () |
47 | tool.Parent:WaitForChild( 'Humanoid' ) |
48 | character = tool.Parent |
49 | player = game.Players:GetPlayerFromCharacter(character) |
50 | damage = ((tool:WaitForChild( 'Config' ):WaitForChild( 'Damage' ).Value * player.Stats.Ats.Strength.Value)/ 10 ) |
53 | humanoid = character:FindFirstChild( 'Humanoid' ) |
56 | print ( 'Found Humanoid!' ) |
59 | print ( 'There is no humanoid.' ) |
63 | tool.Unequipped:connect( function () |
Sorry for the ugliness, I'm trying to produce a bunch of scripts in order to hit a deadline.