local function DecreaseHP(Character)
while true do
wait(10)
if Character.Humanoid.Health > 0 then
Character.Humanoid:TakeDamage(7)
end
end
end
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(DecreaseHP)
end)
This should work, idk why you’re not using a CharacterAdded Event it’s easier to use
Confused why you have to utilize a function, just simplfy the script
game.Players.PlayerAdded:Connect(function(plr)
player.CharacterAdded:Connect(function(char)
while true do
wait(10)
char.Humanoid.Health -= 7
end
end)
end)
Or if you really want to, then here
local function takeHealth(char)
while true do
wait(10)
char.Humanoid:TakeDamage(7)
end
end
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
takeHealth(char)
end)
end)