#LocalScript works once and then stops working

1 messages · Page 1 of 1 (latest)

rough brook
#
local player = game.Players.LocalPlayer
local bool = player.PlayerGui:WaitForChild("Values"):WaitForChild("Key")


bool.Changed:Connect(function()
    print("7")
    if bool.Value == true then
        print("9")
        local ScreenGUI = player.PlayerGui.DialogueWithPortraitAndChoices
        UserInputService.InputBegan:Connect(function(input)
            if UserInputService:GetFocusedTextBox() then
                print("13")
                return
            end
            if input.KeyCode == Enum.KeyCode.X then
                
                ScreenGUI:Destroy()
            else
                ScreenGUI:Destroy()
            end
        end)
        bool.Value = false
    end
end)



#

The bool is changed when the player clicks a part.