Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is it when the specified key is pressed, nothing appears in the output?

Hello everyone, hope you all are having a lovely day! So, i was creating a script (its located in the StarterPlayer.StarterPlayerScripts ) and when i press "L" - nothing happens - im completly baffeled ;-; can someone please show me how to fix it ?

thanks - goku

local player = game.Players.LocalPlayer -- something else
local ipit = game:GetService("UserInputService")


ipit.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.E then
		print("22")
	end
end)

1 answer

✓ Accepted answer

Well, I dont know which script you used.. but if it was a ServerScript. This wouldn`t work. Why? Because LocalPlayer can only work in a LocalScript, not ServerScript. You also placed it in thw wrong place. You should have placed it inside StarterPack. I dont know if you noticed but you said you pressed L, you made the key E, not L.

And one more thing:

print("Hello!") --When you write a text, you HAVE to include them " "

print(22) --When you write a number, you dont need to include them " ", but both ways work.

print("There are 22 cows") --Even if you have a number with a text, you still need them " ", since you got a text.

Hope I helped. :)

2 comments

0

Thanks and i really feel dumb now :P

0

Sometimes I do to when I make really small mistakes like messing up the names. lol :P

This discussion is preserved as it was. New answers, comments, and votes are closed.