How do i fix this? Animation + Tool the error im getting is attempt to index nil with 'Parent' [closed]
Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).
in case you cant copy here is raw paste https://pastebin.com/raw/6jC7hnzn
Edited
01 | local tool = script.Parent |
02 | local Players = game:GetService( "Players" ) |
03 | local player = Players.LocalPlayer |
04 | local character = player.Character |
05 | while character.Parent = = nil do |
06 | character.AncestryChanged:Wait() |
08 | local leaderstats = player.leaderstats |
11 | local humanoid = character:WaitForChild( "Humanoid" ) |
12 | local animation = tool.Animation |
13 | local animationTrack = humanoid:LoadAnimation(animation) |
16 | tool.Activated:Connect( function () |
21 | print ( "Animation Played!" ) |
22 | leaderstats.Strength.Value = leaderstats.Strength.Value + 1 |
23 | print ( "Strength Added!" ) |
27 | print ( "Cooldown Done!" ) |
Don't ever delete what a moderator has added on your question, or it will get moderated!
Error: attempt to index nil with 'Parent
[Edit by JesseSong:] Tip use a codeblock when answering questions, as it makes it easier and legible for us to read.