local Var = false
Var = true
while Var == true do
if hit.Parent.Humanoid.Health >= 1 then
hit.Parent.Humanoid:TakeDamage(1)
else
Var = false
end
wait()
end
Do not remove the wait() but play around with it to get that smooth effect you can also make them take 0.3 damage or something.
For some reason the damage piles up on the wait and deals all the damage that has been piled up at once, is there a way to fix it so only the specified damage hurts you after the wait ends?
script.Parent.Touched:Connect(function(hit)
while hit ~= nil do
hit.Parent:WaitForChild("Humanoid"):takeDamage(3)
wait(1)
hit.Parent:WaitForChild("Humanoid"):takeDamage(3)
end
end)
its kind of delayed but works...or is it?
local Var = false
Var = true
while Var == true do
if hit.Parent.Humanoid.Health >= 1 then
hit.Parent.Humanoid:TakeDamage(1)
else
Var = false
end
wait(0.5)
end
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent:FindFirstChild("Deb") == nil then
local Bool = Instance.new("BoolValue",hit.Parent)
Bool.Name = "Deb"
local Var = false
Var = true
while Var == true do
if hit.Parent.Humanoid.Health >= 1 then
hit.Parent.Humanoid:TakeDamage(1)
else
game.Debris:AddItem(Bool,0)
Var = false
end
wait()
end
Hey, we are not here to spoon-feed code, maybe at least try this yourself or hire someone to do it for you. Just for future posts.
Now for about your problem…
I’d recommend using magnitudes for the part touched thingy cause not gonna lie touched is really bad for this. Also add a debounce so it doesn’t keep on doubling Vector3 | Documentation - Roblox Creator Hub.
and use the other peoples code post above for the rest
script.Parent.Touched:Connect(function(plr)
if plr.Name == "HumanoidRootPart" then -- If there are problems with this change to "Torso"
local box = plr.Parent:FindFirstChild("Humanoid")
if box then
while box.Health > 0 do
box:TakeDamage(10) -- Damage per wait
wait(.1) -- Wait time
end
end
end
end)
Only problem with this is that parts haves to touch torso else it won’t work, if you need tell me and i will update it soo it would work for legs and arms