Hello,
I was testing with hitboxes today and I know how I could make simple 1 hitbox attacks. The problem is if I needed multiple hitboxes to be spawned after each other after a certain amount of time. For example the player threw 10 punches within 1 second, that would be a hitbox every 0.1 second. Would I use RunService (I would imagine not because I want to spawn a hitbox every 0.1 second and not every frame) or a loop with a wait(0.1)?
If you want precision, use RunService.RenderStepped.
You did say it runs every frame, but you can use another variable like so:
local RunService = game:GetService("RunService")
local repeatInterval = .1
local t = 0
RunService.RenderStepped:Connect(function(step)
t += step
if t > repeatInterval then
t -= repeatInterval
-- do stuff
end
end)
What if it was a dash attack which spawned a hitbox at the attacker’s RootPart every frame? How would you make up for lag with that, if you just spawned the amount of hit boxes missed they would all be at the attacker’s RootPart instead of the skipped parts of the dash path. Example:
How would you spawn those missed hitboxes where they need to be in the path of the dash?
Honestly you could use a repeat loop or a for loop and get the amount punches you want and time you want like so time/punches in my opinion using a for loop would be easier like so;
local punches = 10
local time = 1–second
for i = 1, punches, 1 do
—spawn your parts
wait(time/punches)
end