Printing hi infinitly doesnt work help

Hello im trying to use a while loop to print ‘hi’ when a gui is visible and when they toggled a button on

i used to events hence why i used _g

right now its printing(“Denied”)
when i want it to print ‘hi’ forever

script: 1 (this plays when a player toggles a button. when they close the gui its stops the script and when they reopen it contuines this is for optomization

lua
local ToggleValueTrueOrFalse = music.free.hddtv.TextButton.toggle _G.LoopsPlaying = false   _G.StopPlayingIfFalse = false
music.Changed:Connect(function()
    if music.Visible == true and _G.LoopsPlaying == true then
        ToggleValueTrueOrFalse = true    
    elseif music.Visible == false and _G.LoopsPlaying == true then
        ToggleValueTrueOrFalse = false end end)
    if ToggleValueTrueOrFalse == true then
        _G.LoopsPlaying = true
        _G.StopPlayingIfFalse = true
        while _G.StopPlayingIfFalse  do task.wait(0.1) print("hi")end
            if ToggleValueTrueOrFalse == false and music.Visible == true then
            _G.lastseen = false break end end
    elseif ToggleValueTrueOrFalse == false then
        print("Denied")
        ToggleValueTrueOrFalse = true
        _G.StopPlayingIfFalse = false end end)

script: 2 (a button to toggle the loop)

lua
script.Parent.MouseButton1Click:Connect(function()
        if ToggleValueTrueOrFalse == true then
            ToggleValueTrueOrFalse = false
        elseif ToggleValueTrueOrFalse == false then
            ToggleValueTrueOrFalse = true end)```
errors: none | output: "Denied" | what it should be doing output: "hi"inf