I’ve been working on an aura that emits from players, based on stats.
My issue is that it only updates the aura upon player-death;
The intended function is for the emitter to change color[It does] when the player changes stats, updating every second to make sure the color and scaling is correct. For reference, I test min-max stat changes through kills, but the stats don’t take immediate effect.
I tried integrating a “While wait() do” to try to repeat the code: Failure.
Tried to separate the aura-change, but the player still needs to die for it to update: Failure.
I even attempted to update the aura with a pre-made version with an updater-script within it: Only applies upon dying.
The aura’s coloration works off two stats. One stat controls the color red in negative-values, also controlling the color blue in positive values. While the second stat is responsible for green, the caps being fairly high and having minimum-stats in the negatives for an elaborate purpose later, unrelated to the aura.
while wait(1) do
wait()
fire.Color = Colored
fire.Transparency = Colored
fire.Color = Colored
fire.Transparency = mastery
As far as I know, every time I return to test, the aura goes from a pure-white, 255,255,255, into a yellow color, which lets me know that it works. It just doesn’t, for some reason, want to change color when repeated.
I would try adding a pcall to catch any errors, and I would also use task.wait for more efficiently
while task.wait(1) do
local success,errorinfo = pcall(function()
task.wait()
fire.Color = Colored
fire.Transparency = Colored
fire.Color = Colored
fire.Transparency = mastery
end)
if not success then
print(errorinfo)
end
end
My only conclusion is that it sets the entire script to only work when the player’s character has spawned in; rather than whether they’re spawned, or exist.