01 | local textlabel = game.StarterGui.ScreenGui.TextLabel |
02 | game.Players.LocalPlayer:GetMouse().KeyDown:Connect( function (KeyPressed) |
03 |
04 | if KeyPressed = = "g" then |
05 |
06 | if game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel.Text = = "Shii-Cho" then |
07 |
08 | game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel.Text = "Makashi" |
09 | else |
10 | game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel.Text = "Shii-Cho" |
11 | if game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel.Text = = "Makashi" then |
12 |
13 | game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel.Text = "Soresu" |
14 |
15 | end |
16 | end |
17 | end |
18 | end ) |
Take a different approach. UserInputService is more appropriate.
01 | label = game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel |
02 | game:GetService( "UserInputService" ).InputEnded:Connect( function (key) |
03 | if key.KeyCode = = Enum.KeyCode.G then |
04 | if label.Text = = "Shii-Cho" then |
05 | label.Text = "Makashi" |
06 | elseif label.Text = "Makashi" then |
07 | label.Text = "Soresu" |
08 | else |
09 | label.Text = "Shii-Cho" |
10 | end ) |