When the script gets to "while true do" it simply crashes my studio, I added the 5 second wait already just to make sure about what exactly was making the game crash... What is wrong about this?
local player = game.Players.LocalPlayer
repeat wait() until player.Character ~= nil
repeat wait() until player.Character:FindFirstChild("Humanoid")
print("Started working")
script.Parent.MainFrame:WaitForChild("CharacterPortrait")
local imageP = script.Parent.MainFrame.CharacterPortrait.PlayerImage
local level = player.Stats.level.Value
local name = player.Name
imageP.Image = "https://www.roblox.com/bust-thumbnail/image?userId=" ..player.UserId.. "&width=420&height=420&format=png"
script.Parent.MainFrame.CharacterPortrait.Level.Text = level
script.Parent.MainFrame.Name1.Text = name
script.Parent.MainFrame.Name2.Text = name
wait(5)
while true do
if player.Character:FindFirstChild("Humanoid") ~= nil then
script.Parent.MainFrame.HealthBar.HP.Text = "HP: " .. math.floor(player.Character.Humanoid.Health) .. " / " .. player.Character.Humanoid.MaxHealth
end
end
