in case you cant copy here is raw paste https://pastebin.com/raw/6jC7hnzn Edited


local tool = script.Parent
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character
while character.Parent == nil do
	character.AncestryChanged:Wait()
end
local leaderstats = player.leaderstats
local cooldown = 2
local ready = true
local humanoid = character:WaitForChild("Humanoid")
local animation = tool.Animation
local animationTrack = humanoid:LoadAnimation(animation)


tool.Activated:Connect(function()
	
	if ready == true then
	animationTrack:Play()
	--animationTrack.Looped = true
	print("Animation Played!")
	leaderstats.Strength.Value = leaderstats.Strength.Value + 1
	print("Strength Added!")
	ready = false
	animationTrack:Stop()
	wait(cooldown)
	print("Cooldown Done!")
	ready = true
	end
end)

#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.

6 comments

0

in case you cant copy here is raw paste https://pastebin.com/raw/6jC7hnzn

0

Try inputting this line of code after you declare the character variable:

0

test

0

(Having trouble getting the formatting down - try pasting this code block right after you declare the variable "character" https://pastebin.com/raw/kb0dXH8N

0

it doesn't give me error anymore but animation wont play

0

nvm it sill gives me the same error