local mob = script.Parent
local poison = mob:WaitForChild("Poison")
if poison.Changed then
wait(1)
if poison.Value == true then
while true do
mob.Humanoid:TakeDamage(25)
print("HES GASSED")
task.wait(1.5)
end
else
print("WHY IT CHANGE THEN")
end
end
I have an addition script for targeting that sets the Value to true, which works fine.
The target will take initial damage from the targeting script, Value is True, and then I see the WHY IT CHANGE print function after.
I’ve checked both client and server side, the Value IS set to true, but the poison script always says that it is false.
I’ve added waits and it does not help, am I doing it wrong using Changed or what is the issue?
poison.Changed:Connect(function()
wait(1)
if poison.Value == true then
while true do
mob.Humanoid:TakeDamage(25)
print("HES GASSED")
task.wait(1.5)
end
else
print("WHY IT CHANGE THEN")
end
end)
Instead? Because I don’t think that poison.Changed would work because that is an event for when the value changes so you can’t really check it with an if statement.
local mob = script.Parent
local poison = mob:WaitForChild("Poison")
while true do
if poison.Value == true then
while true do
mob.Humanoid:TakeDamage(25)
task.wait(1.5)
end
else
end
task.wait(1.5)
end