This is weird... No errors in the dev console.. and nothing in the script...... and this is in a local script, if that helps anything
Any help? My code:
local frame = script.Parent.Parent.key_frame local button = script.Parent local textOpen = "SHOW ANIMATION KEYS" local textClose = "HIDE ANIMATION KEYS" if frame.Parent.key_show_hide_btn.Text == textOpen then button.MouseButton1Down:connect(function() frame.Visible = true button.Text = textClose end) elseif frame.Parent.key_show_hide_btn.Text == textClose then button.MouseButton1Down:connect(function() frame.Visible = false button.Text = textOpen end) end
local frame = script.Parent.Parent.key_frame local button = script.Parent local textOpen = "SHOW ANIMATION KEYS" local textClose = "HIDE ANIMATION KEYS" button.MouseButton1Down:Connect(function() if frame.Parent.key_show_hide_btn.Text == textOpen then frame.Visible = true button.Text = textClose elseif frame.Parent.key_show_hide_btn.Text == textClose then frame.Visible = false button.Text = textOpen end end)
The way you had it set up, if the text = textOpen when the game runs then it'll just change it to textClose every time you click it
Try.
local frame = script.Parent.Parent.key_frame local frameText = script.Parent.Parent.key_show_hide_btn.Text local button = script.Parent local textOpen = "SHOW ANIMATION KEYS local textClose = "HIDE ANIMATION KEYS" if frameText == textOpen then button.MouseButton1Down:connect(function() frame.Visible = true button.Text = textClose frameText == textClose elseif frameText == textClose then button.MouseButton1Down:connect(function() frame.Visible = false button.Text = textOpen frameText == textOpen
Check it if it works.
No. No. Do NOT have end with ) inside of ends WITHOUT. ITS UGLY AND UNPROFESSIONAL
end) -- ???????? end
And you didn't have to do all that checking if it was visible or not.
local openTxt = "SHOW ANIMATION KEYS" local closeTxt = "HIDE ANIMATION KEYS" script.Parent.MouseButton1Click:Connect(function() -- Connect not connect script.Parent.Parent.key_frame.Visible = not script.Parent.Parent.key_frame.Visible -- Changes the current visible state to its opposite. Make sure the TextButton is not in the frame. if script.Parent.Parent.key_frame.Visible == true then script.Parent.Text = closeTxt else script.Parent.Text = openTxt end end)