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

Function of a click of text button isn't working. why?

Asked by
hallmk7 50
4 years ago

hello everyone, i made a gui consisting of frames. in the following script(local script inside of the frame) i want a script in which a player when enters his name in textbox makes a gui tween, but the tween part doesn't work after i click the button for the same. here's the local script:-

local player = game.Players.LocalPlayer
local textBox = player.PlayerGui.OrderGui:WaitForChild("MainFrame").TextBox
local MainFrame = player.PlayerGui.OrderGui.MainFrame
local MainFrame2 = player.PlayerGui.OrderGui.MainFrame2
local Players = game.Players:GetPlayers()
local functionEnabler = false
local EnterButton = player.PlayerGui.OrderGui.MainFrame.EnterButton
local Players = game.Players:GetPlayers()

textBox:GetPropertyChangedSignal("Text"):Connect(function()

    EnterButton.MouseButton1Click:Connect(function()

    local NameEntered = textBox.Text

    for _,v in pairs(Players) do
     if player.Name == v.Name then 

        functionEnabler = true

    else
        functionEnabler = false

    end


game.StarterGui.OrderGui.MainFrame.SelectUserButton.MouseButton1Click:Connect(function()
    if functionEnabler == true then
        print("tween started")
        MainFrame:TweenPosition(UDim2.new(0.294, 0, -2, 0), 'Out', 'Linear', 1)
        wait(2)
        MainFrame2:TweenPosition(UDim2.new(0.294, 0, 0.127, 0), 'Out', 'Sine', 1)

    end
end)
end
end)    
end)

Answer this question