Post: FontString text recreation problems
10-29-2015, 09:15 PM #1
BullyWiiPlaza
Climbing up the ladder
(adsbygoogle = window.adsbygoogle || []).push({}); I have a script that draws text and a bar on-screen for the player's health. When the player dies, both elements are destroyed. However, after a few deaths, the text is no longer drawn. Why is that? I also tried calling
    clearAllTextAfterHudElem();
on it but it still stopped drawing the text.

    drawHealthBar()
{
self endon("disconnect");

self.healthBar = self createBar((1, 1, 1), 150, 11);
self.healthBar setPoint("CENTER", "TOP", 0, 42);
self.healthText = self createFontString("default", 1.5);
self.healthText setPoint("CENTER","TOP", 0, 22);
self.healthText setText("^1H^2E^3A^4L^5T^6H");

while(true)
{
healthRatio = self.health / self.maxHealth;
self.healthBar updateBar(healthRatio);

if(self.health == 0)
{
self.healthBar destroy();
self.healthText destroy();
self.healthText clearAllTextAfterHudElem();

return;
}

wait 0.1;
}
}


Note:
My workaround is to never destroy the elements however, I would still like to know how to fix this by allowing "unlimited" text recreations without issues Happy
(adsbygoogle = window.adsbygoogle || []).push({});

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo