so i was coding a dash for my boss so you cant just damage him forever,
here is the script, (i want him to dash every 8 to 25 seconds)
task.spawn(function()
while true do
wait(math.random(8,25))
dashAnim:Play()
dashAnim.Priority = Enum.AnimationPriority.Action4
game:GetService("SoundService").dash:Play()
local back = Vector3.new(0,0,-3)
local up = Vector3.new(0,-3,0)
local bv = Instance.new("BodyVelocity", hrp)
bv.Name = "Knockback"
bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
bv.Velocity = hrp.CFrame.LookVector * 45 + back + up
game.Debris:AddItem(bv,.25)
end
end)
You’re using task.spawn. The task.spawn function will break through any task.wait()'s, especially if this is inside of a loop such as RunService.Heartbeat, while true do, for loop, etc. Try swapping places with the while true do loop and adding the task.spawn function inside it or any other methods you might know of. My specialty in coding is definitely not functions like these, but I can tell you that your task.spawn function is definitely the cause of it.
Maybe because you’re using incorrect statements.
There are 2 types of options you can do:
Option 1
You can convert task.spawn to spawn()
spawn(function()
while true do
wait(math.random(8,25))
dashAnim:Play()
dashAnim.Priority = Enum.AnimationPriority.Action4
game:GetService("SoundService").dash:Play()
local back = Vector3.new(0,0,-3)
local up = Vector3.new(0,-3,0)
local bv = Instance.new("BodyVelocity", hrp)
bv.Name = "Knockback"
bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
bv.Velocity = hrp.CFrame.LookVector * 45 + back + up
game.Debris:AddItem(bv,.25)
end
end)
Option 2
You can convert “true” to task.wait()
task.spawn(function()
while task.wait() do
wait(math.random(8,25))
dashAnim:Play()
dashAnim.Priority = Enum.AnimationPriority.Action4
game:GetService("SoundService").dash:Play()
local back = Vector3.new(0,0,-3)
local up = Vector3.new(0,-3,0)
local bv = Instance.new("BodyVelocity", hrp)
bv.Name = "Knockback"
bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
bv.Velocity = hrp.CFrame.LookVector * 45 + back + up
game.Debris:AddItem(bv,.25)
end
end)
Can you show me the part where he walks?
And also can you show me the part where he punches too? (By the video I’ve seen, I think that’s where he demolishes most of the parts)