I have been trying to get my poison script to work but it just won't. I have been on the roblox wiki looking for an anwser but i can't find anything.
Her is my script
local dmg = -10
function onTouched(part)
local humanoid = part.Parent:FindFirstChild("Humanoid")
if (humanoid ~= nil) then
while true do
local currenthealth = humanoid.Health
local NewHealth = currenthealth + dmg
humanoid.Health = currenthealth
wait(1)
if humanoid.Health == 50 then
break
end
wait()
end
end
end
script.Parent.Touched:connect(onTouched)
wait()
I am very new to scripting so my script is probably really bad!

1 comment
Thank you!