Guten tag!
I am trying to create a script that creates hallucinations after a certain value gets below 65
However, one of the values i have made gets stuck in an “Infinite Yield” or put it simply… it doesn’t “exist” and it halts the entire script from running
I have tried to look in the client as im playing if the nil value (Stats), exists, which it indeed does and even appears on my screen normally, i have also checked if Archived is true, which it is.
Here is the part of the script that defines these values the problem is the Status Value
--//Values//--
Players = game:GetService("Players")
Tween = game:GetService("TweenService")
local LP = Players.LocalPlayer
local Char = LP.Character or LP.CharacterAdded:Wait()
local PlayerUI = LP:WaitForChild("PlayerGui")
local energyBar = PlayerUI:WaitForChild("gameUI")
local Status = energyBar:WaitForChild("Stats")
local TLabel = Status:WaitForChild("TextLabel")
local ILabel = TLabel:WaitForChild("ImageLabel")
local Hum = Char:WaitForChild("Humanoid")
Red = Color3.fromRGB(85, 0, 0)
DefaultColor = Color3.fromRGB(0, 85, 0)
Percentage = "100"
Camera = workspace.CurrentCamera
maxSongs = 6
I have checked those and i haven’t found anything
Here is the error i get, which proves none of the other values are wrong as it looks in the correct place where it should be located
Could you check if the frame exists at runtime? It would be under player.PlayerGui. Also could you check that the ScreenGui’s ResetOnSpawn property is false?
Is the ResetOnSpawn property false on gameUI? I’ve run into a similar issue and it was because I was referencing an old instance that was garbage collected already
That’s because when the player spawns, the screen gui is reset which means anything that wasn’t there before (like objects added by scripts) would be removed when the player respawns.
So basically
I have a ScreenGui
Add a button called “TextButton” via script
Reset
TextButton no longer exists.