Here is a script that slowly does damage while the player is in it. Unfortunately it doesn't work all the time. I put it in a block and put the blocks down different places so when the player walks through it it does damage.
~~~~~~~~~~~~~~~~~
local damage = 1 local touched local timebeforeotherdamage = 1
script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then if touched == false then touched = true repeat if touched == true then hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - damage end wait(timebeforeotherdamage) until hit.Parent.Humanoid.Health == 0 end end repeat wait() until touched == false end) script.Parent.TouchEnded:Connect(function(hit) touched = false end) ~~~~~~~~~~~~~~~~~
sometimes it will do a little damage, but when you go out of the block and back in, it does A LOT. The code looks fine to me so I don't know whats wrong...
This might work! Put this in a script inside of your damage part. Change the wait(1) to change how many seconds you want to wait in between damaging. Change the hum:TakeDamage(50) to how much damage you want to do. If this doesn't work or gives an error, tell me in the comments of this answer and I'll fix my code.
local part = script.Parent local debounce = false part.Touched:Connect(function(touched) local hum = touched.Parent:FindFirstChild("Humanoid") --if its a player if hum then if debounce == false then hum:TakeDamage(50) --Damage you want to do wait(0.5) --wait whatever amount of seconds debounce = true end end end)
**EDIT: you can make it the part's transparency 1 and cancollide false to make it sort of an invisible "damage zone"
Make sure it's a server script and inside of your part. Hope this works :)