Hello everyone!
I’m making a Tower Defense game and I’m trying to make a tower that would scream and boost every ally’s stats that are in a certain hitbox part
The script doesn’t seem to work however.
It only prints: “boosted stats” which is according to the script, but the rest of the script won’t work
this is the script:
local db = false
wait(10)
print("boosted stats")
script.Parent.hitbox.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("isally") then
if hit.Parent:FindFirstChild("damage") then
if db == false then
db = true
script.Parent.scream:Play()
hit.Parent.damage.Value = hit.Parent.damage.Value * 2
wait(20)
hit.Parent.damage.Value = hit.Parent.damage.Value / 2
db = false
end
end
end
end)
Touched is very inconsistent with detection and the problem right now is that it’s most likely not detecting anything in the part that isn’t moving. I recommend using the ZonePlus v2 module, one way you can do this is you using use the getParts function from that module to see if the part in a zone’s parent is an ally and boosting them from there.
thank you.
i have one more question, i don’t quite understand that module you sent me. judging by what i saw, there were only player detections. are there any normal entities detections? (for example a sniper)