This has been solved. The solution was to use the KeyUp event instead of KeyDown.
Original Post:
What I want this to do is once you press /, every time you press a key after that it will be added to a string variable called theString, until you press Enter and it resets. This works, but it will not record certain keys like numbers, i, and o. Is there any way to get around this?
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local addToString = false
local theString = ""
mouse.KeyDown:connect(function(key)
if key == "/" and not addToString then
addToString = true
print("add to String is true")
elseif theString.byte(key) == 13 and addToString then --13 = "Enter"
print(theString)
theString = ""
addToString = false
elseif theString.byte(key) ~= 13 and addToString then
theString = theString..key
print(key.." was added to the String")
end
end)

3 comments
I see that now... But it worked even with theString.byte(key) which doesn't make sense.
It worked because usually when you call
byteas a method, you use a colon. You used a period and you passed it a parameter, so it worked normally.Weird.