How do i create constant poison damage?

One tutorial.

image
Inside the Poison script in player :

PoisonScript Script

Script for PoisonScript :

local Poisoned = script.Parent:WaitForChild("Poisoned") -- you can change the name if you want
local PoisonDmg = script.Parent:WaitForChild("Poison Damage") -- you can also change the name

local Humanoid = script.Parent:WaitForChild("Humanoid")


Poisoned:GetPropertyChangedSignal("Value"):Connect(function()
	if Poisoned.Value == true then
		repeat
			if Poisoned.Value == true then
				wait(0.1) -- customize how often you want your poison to damage
				Humanoid:TakeDamage(PoisonDmg.Value) -- i forgot .Value here
			else
				break
			end
		until Poisoned.Value == false
	elseif Poisoned.Value == false then
		return
	end
end)

And then


Inside PoisonOtherPlayer script :

DamageOtherPlayer Script

Script for DamageOtherPlayer :

local part = script.Parent

part.Touched:Connect(function(object)
	if object:FindFirstAncestorWhichIsA("Model") and object:FindFirstAncestorWhichIsA("Model"):FindFirstChildWhichIsA("Humanoid") then
		print("Found")
		local Model = object:FindFirstAncestorWhichIsA("Model")
		local PoisonValue = Model:FindFirstChild("Poisoned")
		local PoisonDmg = Model:FindFirstChild("Poison Damage")
		if PoisonValue and PoisonDmg and Model then
			PoisonValue.Value = true
			PoisonDmg.Value = 0.5 -- damage of the poison.
			wait(10) -- change to how long you want the poison to stay with the character
			PoisonValue.Value = false
			PoisonDmg.Value = 0
		end
	end
end)

So uh i decided to do this because i highly doubt that with words you won’t really make it so im sorry if this waste a lot of your time!

1 Like

it doesnt, thats actually fine, i can understand words but it wont waste my time!

2 Likes

Nice tutorial. You should upload it to #resources:community-tutorials.

I’m glad the problem was solved. But you could use a while loop instead of repeat until to get rid of that warning.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.