fourjames
(fourjames)
June 13, 2021, 1:18am
1
So I placed the script inside Starter Player > StarterCharacterScripts and when I pressed play to test my script nothing seemed to be printing.
local uis = game.GetService (“UserInputService”)
uis.InputBegan:connect (function(input,gpe)
if input.Keycode == Enum.KeyCode.H then
print (“Test”)
end
end)
arhium
(alwaysrrr)
June 13, 2021, 1:19am
2
the “.” Should be “:”
fourjames:
connect
Capitalize the first letter of connect.
1 Like
runaredie
(Fresh Joe)
June 13, 2021, 1:20am
3
Did you use a local script or a script?
fourjames
(fourjames)
June 13, 2021, 1:21am
4
I used a script on startercharacterscripts
runaredie
(Fresh Joe)
June 13, 2021, 1:22am
5
Use a local script instead server scripts don’t work for client functions
fourjames
(fourjames)
June 13, 2021, 1:25am
7
Now it says here " Keycode is not a valid member of InputObject “InputObject” - Client - LocalScript:3"
local uis = game:GetService(“UserInputService”)
uis.InputBegan:Connect(function(input,gpe)
if input.Keycode == Enum.KeyCode.H and not gpe then
print (“Test”)
end
end)
try thsi
Make the First KeyCode(input.Keycode) Input.KeyCode
Which would then look like this(in your code):
local uis = game:GetService("UserInputService")
--Added a space for better readability | Also indented
uis.InputBegan:Connect(function(input, gpe)
if input.KeyCode == Enum.KeyCode.H then
print("Test")
end
end)
fourjames
(fourjames)
June 13, 2021, 1:51am
10
Now it says here " Keycode is not a valid member of InputObject “InputObject” - Client - LocalScript:3"
OHHH! rename input.Keycode to input.KeyCode
fourjames
(fourjames)
June 13, 2021, 1:58am
13
But aren’t those the same? Or am I just that bad at scripting…
its the same but things are case sensitive(meaning that it has to be spelled exactly right)
If I am correct thats what I said?
Yes they are the same name but its case sensitive. So its understands what KeyCode means but not Keycode.
Also the script I provided fixes that error, so make sure you actually updated it.