Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make this work? Script function - print word "A" when key A is pressed

Asked by 4 years ago

I created a script using service UserInputService so it print A when the key "A" is pressed. However it doesn't work. I tried direct copy and paste but it doesn't work either.

Here it is

local D = game:GetService("UserInputService")

D.InputBegan:Connect(function(input, gameProcessed) if input.KeyCode == Enum.KeyCode.A then print("A") end end)

1 answer

Log in to vote
4
Answered by
Lakodex 711 Moderation Voter
4 years ago

Issue

You are using a serverscript

Fix

Use a localscript

Ad

Answer this question