local player = game.Players.LocalPlayer
local character = player.Character
local CanAttack = true
Tool = script.Parent
sword = script.Parent.Handle
Tool.Equipped:connect(function(mouse)
local equip = script.Parent.Parent.Humanoid:LoadAnimation(script.Equip)
local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "rbxassetid://821439273"
UnsheathSound.Parent = sword
UnsheathSound.Volume = 1
print("A tool was equipped")
equip:Play()
UnsheathSound:play()
local Power = script.parent:WaitForChild("powercall")
local Effects = Power:FindFirstChild("ParticleEmitter")
Power.Position = character:WaitForChild("Torso").Position
Power.Anchored = true
do
Effects.Enabled = true
wait(2.5)
Effects.Enabled = false
end
end)
script.Parent.Activated:connect(function()
local attack = script.Parent.Parent.Humanoid:LoadAnimation(script.Attack)
local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "rbxassetid://187747824"
SlashSound.Parent = sword
SlashSound.Volume = .7
if CanAttack == true then
attack:Play()
SlashSound:play()
CanAttack = false
wait(1)
attack:Stop()
CanAttack = true
script.Parent.CanDamage.Value = true
end
end)
Error Message - 16:35:22.217 - Players.Player1.Backpack.Lighting Of Power.LocalScript:24: attempt to index upvalue 'character' (a nil value) |