Can anyone tell me why this script won't work? Output show's no error's. I am trying to make a Custom-Chat GUI, But this KeyDown thing won't work.
wait(1) -- Variables local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local Text = script.Parent.TextFrame.TextBox -- Main Script Mouse.KeyDown:connect(function(key) if key == Enum.KeyCode.Slash then Text:CaptureFocus() end end)
Problem Roblox locks backslash as its used in their own functions this is able from this script below. Solution
-- Variables local Player = game.Players.LocalPlayer repeat() wait until Player.Character local Mouse = Player:GetMouse() local Text = script.Parent.TextFrame.TextBox -- Main Script game:GetService("UserInputService").InputBegan:connect(function(input) if input.KeyCode == Enum.KeyCode.Slash then Text:CaptureFocus() end end