I know what’s happening and what’s making this script not work but I don’t know how to fix it. Here’s the script:
local Player = game.Players.LocalPlayer
--local Vacuus = Player:WaitForChild("Backpack").Vacuus
--local Mouse = Player:GetMouse()
local Animation = Player.Character:WaitForChild("Humanoid"):LoadAnimation(script:WaitForChild("VacuusCasting"))
local ManaStat = Player:WaitForChild("StatsData")["Mana"]
local Cooldown = false
script.Parent.Activated:Connect(function()
if Cooldown == true then return end
Cooldown = true
-- THIS CODE WILL PLAY IF THE PLAYER CAST IT RIGHT
Animation:Play()
wait(1.3)
Player.Character.Humanoid.WalkSpeed = 4
-- LOOPS THE ATTACK 100 TIMES
for i = 1,100 do
wait()
game.ReplicatedStorage["Incantations [EVENTS]"]:WaitForChild("VacuusEvent"):FireServer()
-- IF 'i' IS 100 THEN
if i == 100 then
Animation:Stop(0.5)
Player.Character.Humanoid.WalkSpeed = 16
end
end
Cooldown = false
end)
local Players = gameGetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Animation = Humanoid:LoadAnimation(script:WaitForChild("VacuusCasting"))
Since this is a local script I would do this, I did this in my scripts
local Players = game:GetService("Players")
local player = Players.LocalPlayer
repeat wait(0.25) until player.Character
local Character = player.Character
if not Cooldown then
Cooldown = true
-- THIS CODE WILL PLAY IF THE PLAYER CAST IT RIGHT
Animation:Play()
wait(1.3)
Player.Character.Humanoid.WalkSpeed = 4
-- LOOPS THE ATTACK 100 TIMES
for i = 1,100 do
wait()
game.ReplicatedStorage["Incantations [EVENTS]"]:WaitForChild("VacuusEvent"):FireServer()
-- IF 'i' IS 100 THEN
if i == 100 then
Animation:Stop(0.5)
Player.Character.Humanoid.WalkSpeed = 16
end
Cooldown = false
end