So I got a game where there is an arena and people fight in it. Then I got an Event which triggers that 4 walls spawn and they shrink so all players are forced to move in the middle of the arena. Everything works fine etc BUT If I want to add a deathscript to the walls so they acutally kill you if you touch it, the performance will completly go down. I think its because it is checking everything it touches something to see if it is a hum or not.
Any Idea how to handle this performance wise and only kill the player?
function KillPlayer(part)
h = part.Parent:findFirstChild("Humanoid")
if h ~= nil then
h.Health = 0
end
end
script.Parent.Touched:connect(KillPlayer)

11 comments
u might wanna try h:TakeDamage(100)
or use breakjoints
or h:TakeDamage(h.MaxHealth)
Weird. It shouldn't cause a peformance drop
unless there is some other factor at play here
:TakeDamage() doesn't damage the player if they have a force field tho
just use debounce
Maybe try adding a wait() ? That always helps me with lag
Breakjoints didnt work, tried it too.
Breakjoints didnt work, i tried it too. so weird.
You guys need to read my text on top. Im moving the walls btw, so im using TweenService maybe that.