How to make keypress change text on a gui?
My script
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local gui = game.StarterGui.ScreenGui.Frame.active
mouse.KeyDown:connect(function(Key)
if Key == "T" and gui.Parent.Visible == true and gui.Text == "Inactive (T)" then
Key:Lower()
gui.Text = "Active (T)"
elseif Key == "T" and gui.Parent.Visible == true and gui.Text == "Active (T)" then
Key:Lower()
gui.Text = "Inactive (T)"
end
end)
I have a gui called active and when I press "T" I want it to change text. How would I do this?

7 comments
Says some error at line 9 that there is a "(" missing?
when it does the UIS.InputBegan:Connect(function(Input, gameProcessedEvent) function
Sorry about that, i updated the script
The InputBegan is similar to KeyDown. InputEnded is again similar to KeyUp, which is when you release the key
What about mine?
Thanks!
Np, don't forget to accept the answer