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.
01 | wait( 1 ) |
02 |
03 | -- Variables |
04 | local Player = game.Players.LocalPlayer |
05 | local Mouse = Player:GetMouse() |
06 | local Text = script.Parent.TextFrame.TextBox |
07 |
08 | -- Main Script |
09 | Mouse.KeyDown:connect( function (key) |
10 | if key = = Enum.KeyCode.Slash then |
11 | Text:CaptureFocus() |
12 | end |
13 | end ) |
Problem Roblox locks backslash as its used in their own functions this is able from this script below. Solution
01 | -- Variables |
02 | local Player = game.Players.LocalPlayer |
03 | repeat () wait until Player.Character |
04 | local Mouse = Player:GetMouse() |
05 | local Text = script.Parent.TextFrame.TextBox |
06 |
07 | -- Main Script |
08 | game:GetService( "UserInputService" ).InputBegan:connect( function (input) |
09 | if input.KeyCode = = Enum.KeyCode.Slash then |
10 | Text:CaptureFocus() |
11 | end |
12 | end |