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

Bind an action using a value as the key? Not working...

Asked by 4 years ago

I'm attempting to bind an action using a value as the key needed. It's not working... From what I see in the console, there shouldn't be a problem with it.

So my question is this: Am I doing somthing wrong or is this a possible Roblox bug, and if so, how do I proceed?

\/(The value of "KEY" (a string value) is "Enum.KeyCode.E")\/

local Context_Service =game:GetService("ContextActionService")

Context_Service:BindAction("Name",Function,false,workspace.KEY.Value)

Pressing "E" does absolutely nothing, the function will not fire.

0
Why are you using workspace.KEY.Value instead of Enum.KeyCode.E? RSASDSA 72 — 4y
0
Because I want to change the "KEY" value as a sort of control customizer. A player can change what buttons do what. mbramblet 80 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Can't test it right now, but hopefully it works. Let me know if it doesn't.

local Context_Service = game:GetService("ContextActionService")
local keyValue = game.Workspace.KEY.Value

Context_Service:BindAction("Name", Function, false, Enum.KeyCode[keyValue])
0
Yup, that works! Thanks. mbramblet 80 — 4y
0
No problem! Anytime :) Le_Teapots 913 — 4y
Ad

Answer this question