For some reason this code does not work for me, I never see "DONE" in the output, nor does it say it's not running. How can I fix this?
coroutine.resume(coroutine.create(function() print(coroutine.running()) wait(30) print("DONE") end))
Full Script:
_G.MaxWalkSpeed = 40 _G.DefWalkSpeed = 16 _G.MaxHealth = 500 _G.DefMaxHealth = 200 _G.MaxArmor = 100 -- In Percent _G.DefArmor = 0 _G.Defaults = {["WalkSpeed"] = 16, ["MaxHealth"] = 200, ["Armor"] = 0} database = {} _G.TakeDamage = function(name, damage) player = game.Players:findFirstChild(player) if(player) then if(player.Character) then noid = player.Character.Humanoid noid.Health = noid.Health - damage end end end _G.addEffect = function(name, stat, increase, duration) player = game.Players:findFirstChild(name) if(player) then if(stat == "WalkSpeed") then noid = player.Character.Humanoid if(noid.WalkSpeed < _G.MaxWalkSpeed) then value = noid.WalkSpeed + increase if(value > _G.MaxWalkSpeed) then value = value - (value - _G.MaxWalkSpeed) end table.insert(database, {name, stat, noid.WalkSpeed}) noid.WalkSpeed = value print(("Effects: Set %s's WalkSpeed to %s."):format(name, value)) else print(("Effects: Reached maximum walkspeed on %s."):format(name)) return end elseif(stat == "Armor") then armor = player.Backpack:findFirstChild("Armor") if(armor) then value = armor.Absorbance.Value + increase if(armor.Absorbance.Value < _G.MaxArmor) then if(value > _G.MaxArmor) then value = value - (value - _G.MaxArmor) end table.insert(database, {name, stat, armor.Absorbance.Value}) armor.Absorbance.Value = value armor.Health.Value = 250 else print(("Effects: %s has reached maximum armor."):format(name)) end end elseif(stat == "MaxHealth") then noid = player.Character.Humanoid if(noid.MaxHealth < _G.MaxHealth) then value = noid.MaxHealth + increase if(value > _G.MaxHealth) then value = value - (value - _G.MaxHealth) end table.insert(database, {name, stat, noid.MaxHealth}) noid.WalkSpeed = value print(("Effects: Set %s's MaxHealth to %s."):format(name, value)) else print(("Effects: Reached maximum health on %s."):format(name)) return end end if(duration > 0) then addEffectTimer(name, stat, duration) end end end function hasPrevious(name, stat) for index = 1, #database do entry = database[i] if(entry[1] == name) then if(entry[2] == stat) then return {entry, i} end end end return nil end function addEffectTimer(name, stat, duration) coroutine.resume(coroutine.create(function() print(coroutine.running()) wait(30) print("DONE") end))--[[ print(("%s's %s effect has worn off."):format(name, stat)) player = game.Players:findFirstChild(name) if(player ~= nil) then if(player.Character ~= nil) then if(humanoid[stat]) then humanoid = player.Character.Humanoid previous = hasPrevious(name, stat) if(previous) then humanoid[stat] = previous[1][3] table.remove(database, previous[2]) else humanoid[stat] = _G.Defaults[stat] end elseif(stat == "Armor") then armor = player.Backpack:findFirstChild("Armor") if(armor) then previous = hasPrevious(name, stat) if(previous) then armor.Absorbance.Value = previous[1][3] table.remove(database, previous[2]) else armor.Absorbance.Value = _G.Defaults[stat] end end end --[[ if(stat == "WalkSpeed") then previous = hasPrevious(name, stat) if(previous) then humanoid = player.Character.Humanoid humanoid.WalkSpeed = previous[1][3] table.remove(database, previous[2]) else humanoid = player.Character.Humanoid humanoid.WalkSpeed = _G.Defaults[stat] end elseif(stat == "MaxHealth") then previous = hasPrevious(name, stat) if(previous) then humanoid = player.Character.Humanoid humanoid.MaxHealth = previous[1][3] table.remove(database, previous[2]) else humanoid = player.Character.Humanoid humanoid.MaxHealth = _G.Defaults[stat] end end end end--]] end
This is for my LocalPlayer Admin {Tablets}
coroutine.resume(coroutine.create(function() game:GetService("RunService").Stepped:connect(function()