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

How could i convert a string value into a Key input?

I am creating a customizable KeyCode, but i have no idea on how to put it into a code, The line of code -

if input.KeyCode == Enum.KeyCode(BarrageKey.Value) then

But it doesn't work, (BarrageKey.Value is a variable it's the Key i want to be pressed)

1 answer

✓ Accepted answer

You should be using [] instead of ().

if input.KeyCode == Enum.KeyCode[BarrageKey.Value] then

Hope this helps!

1 comment

0

Thanks it worked!

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