Basically, I want this script to repeat until the character the key is wrong.
-- \\ Misc. Variables // --
local LetterTable = {"L", "N", "I", "O", "E", "Q", "G"}
local plr = game:GetService("Players").LocalPlayer
local PlayerGui = plr:WaitForChild("PlayerGui")
local GUI = game:GetService("StarterGui")
local KEYNAME = GUI.TrainingsGUI
local TRI = GUI.TrainingsGUI
local KEYGUI = GUI.TrainingsGUI.BGWH
-- \\ Player-Related Variables //--
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local HUM = Character:WaitForChild("Humanoid")
local Humrp = Character:WaitForChild("HumanoidRootPart")
-- \\ Get-Services // --
local RS = game:GetService("ReplicatedStorage")
local UIS = game:GetService("UserInputService")
local TS = game:GetService("TweenService")
-- \\ Script-Name // --
local Name = script.Parent.Name
local Toolie = script.Parent
-- \\ Misc. Variables // --
local Debounce = false
-- \\ Functions // --
local function ChangeTheKey()
local chosenkey = LetterTable[math.random(1,#LetterTable)]
PlayerGui:WaitForChild("TrainingsGUI").BGWH.WhiteHolder.Key.Text = chosenkey
end
Toolie.Activated:Connect(function()
if Debounce == true then return end
ChangeTheKey()
if Debounce == false then
Debounce = true
PlayerGui.TrainingsGUI.Enabled = true
TS:Create(PlayerGui.TrainingsGUI.UpBar, TweenInfo.new(.4), {Position = UDim2.new(0, 0,-0.071, 0)}):Play()
TS:Create(PlayerGui.TrainingsGUI.DownBar, TweenInfo.new(.4), {Position = UDim2.new(0, 0 ,0.862, 0)}):Play()
UIS.InputBegan:Connect(function(Input)
if Input.KeyCode == KEYNAME then
PlayerGui:WaitForChild("TrainingsGUI").BGHW.BackgroundColor3.B = 110
PlayerGui:WaitForChild("TrainingsGUI").BGHW.BackgroundColor3.G = 208
PlayerGui:WaitForChild("TrainingsGUI").BGHW.BackgroundColor3.R = 71
HUM.Animator:LoadAnimation(script.Anim):Play()
RS.Progressing:FireServer("PushUp")
PlayerGui:WaitForChild("TrainingsGUI").BGHW.BackgroundColor3.B = 0
PlayerGui:WaitForChild("TrainingsGUI").BGHW.BackgroundColor3.G = 0
PlayerGui:WaitForChild("TrainingsGUI").BGHW.BackgroundColor3.R = 0
end
end)
task.wait(2)
ChangeTheKey()
print("Big bank bih no ones")
Debounce = false
end
end)
The issue comes it that it only worked once.