Whenever you press a key on the keyboard it should execute the script in the text box. Now while I don't have a problem with the executing part the KeyCode function will not fire unless it's QWERTY key. Example: Enum.KeyCode.E -state: works-, Enum.KeyCode.Colon -state: D:-
Script
local UserInputService = game:GetService("UserInputService")
local CommandLine = script.Parent.CommandLine
UserInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Colon
then
if(string.sub(CommandLine.Text,1,7) == string.lower("!print ")) then
local Message = string.sub(CommandLine.Text,8)
print(Message)
else
if(string.sub(CommandLine.Text,1,5)) == "!cash" then
local ammount = game.Players.LocalPlayer.leaderstats.Cash.Value
print("Cash: "..ammount)
else
if(string.sub(CommandLine.Text,1,6)) == "!leave" then
game.Players.LocalPlayer:Kick("Left server")
else
if(string.sub(CommandLine.Text,1,10)) == "!cmds/open" then
script.Parent.Parent.Parent.Commands.Enabled = true
else
if(string.sub(CommandLine.Text,1,11)) == "!cmds/close" then
script.Parent.Parent.Parent.Commands.Enabled = false
else
if(string.sub(CommandLine.Text,1,5)) == "!help" then
local text = "Say !cmds/open to open a list of commands; Say !cmds/close to close the list of commands."
for i = 1,#text do
CommandLine.Text = string.sub(text,1,i)
wait(0.08)
end
else
if(string.sub(CommandLine.Text,1,6)) == "!goto " then
local cframe = string.sub(CommandLine.Text,7)
if cframe == "FFA" then
game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(-3.4, 46.305, 10988.005)
end
else
if(string.sub(CommandLine.Text,1,5)) == "!rchr" then
game.Players.LocalPlayer.Character.Humanoid.Health = 0
else
if(string.sub(CommandLine.Text,1,7)) == "!gspawn" then
game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(-52.4, 18.401, 0.2)
end
end
end
end
end
end
end
end
end
end
end)

4 comments
oml use elseif instead of else if, also you're probably just pushing the wrong button. try printing input.KeyCode and see if it's actually printing "Colon"
I don't need you telling me "use elseif" I need the answer to my problem.
You don't put keycode in a command statement.
What do you mean?