Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why am i getting damaged only once when i walk into my damagearea?

Asked by 3 years ago
Edited 3 years ago

I made a Volcano with a damagearea but im only getting damged once (when i enter the area)

Script inside the damagearea:

script.Parent.Touched:Connect(function(hit)

    if hit.Parent:FindFirstChild("Humanoid") and not hit.Parent:FindFirstChild("LavaHit") then
        local I = Instance.new("IntValue",hit.Parent)
        I.Name = "LavaHit"
        game.Debris:AddItem(I,5)
        hit.Parent.Humanoid:TakeDamage(10)
    end
end)

1
I recommend using Region3 tbh. rabbi99 714 — 3y

2 answers

Log in to vote
1
Answered by
Nckripted 580 Moderation Voter
3 years ago

Touched events only fire once, and that's when the object is on the edge of the collision area. Use Region3s.

0
ok but how valledestroy 54 — 3y
0
You can just use a simple script using the take damage thingy NightWarrior1717 14 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

I`m to lazy to rewrite the script, so I got one from the Dev Forum

local dmg = script.Parent.DamageValue.Value

script.Parent.Touched:Connect(function(part)
    local humanoid = part.Parent:FindFirstChild("Humanoid")
    if humanoid then
        humanoid:TakeDamage(dmg)
    end
end)

It is a pretty simple script, you just add an IntValue named DamageValue and assign the damage you want to be dealt when it is touched. If you want to make it damage you multiple times I have a model of an effective damage brick which takes a customizable amount of damage and after a customizable interval of time it will take the same amount of damage. Here https://web.roblox.com/catalog/5618332380/Damage-Brick

0
Hope that helps! NightWarrior1717 14 — 3y

Answer this question