Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Changed event not working with textbox?

Asked by
NotSoNorm 777 Moderation Voter
8 years ago

Filtering Enabled, Local script

I'm trying to make it so when the player types in the gui it would replicate onto the surface gui nothing is happening but I'm getting no errors

searchbar.OnScreenText.MouseButton1Down:connect(function()
    local gui = script.SearchGui:Clone()
    gui.Parent = game.Players.LocalPlayer.PlayerGui
    gui.SearchGuiBox:CaptureFocus()
    searchbar.OnScreenText.Text = ""

    spawn(function()
        searchbar.OnScreenText.Changed:connect(function(Text) --This line
            wait(.1)
            if gui and gui:FindFirstChild("SearchGuiBox") then
                searchbar.OnScreenText.Text = gui.SearchGuiBox.Text
                search(gui.SearchGuiBox.Text,false)
            end
        end)
    end)

    searchbar.SearchEnter.MouseButton1Down:connect(function()
        search(searchbar.OnScreenText.Text,true)
    end)
    --Player types some poopy stuff
    gui.SearchGuiBox.FocusLost:connect(function(enter)
        if enter then
            search(gui.SearchGuiBox.Text,false)
            gui:Destroy()
        else
            searchbar.OnScreenText.Text = gui.SearchGuiBox.Text
            gui:Destroy()
        end
    end)
end)

Answer this question