I want to detect if the pressed key is equal to a value in the parent of the script.
The issue is it gives me the error : is not a valid member of “Enum.KeyCode”
I tried looking on the dev hub but i couldnt find anything that could fix it
local CD = false
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(key,istyping)
if istyping then
return
else
if key.KeyCode == Enum.KeyCode[script.Parent.Key.Value] then
if CD == false and game.Players.LocalPlayer.Stats.CursedEnergy.Value >= script.EnergyConsume.Value and game.Players.LocalPlayer.Character.Modifiers.Stunned.Value == false then
local Mouse = game.Players.LocalPlayer:GetMouse()
CD = true
local Name = script.Parent.Name
game.ReplicatedStorage.CursedEnergy:FireServer(script.EnergyConsume.Value)
game.ReplicatedStorage.BackpackDisable:FireServer()
game.ReplicatedStorage.Techniques:FindFirstChild(script.Parent.Technique.Value):FindFirstChild(script.Parent.Name):FireServer(Mouse.Target)
script.Parent.Name = script.CD.Value
for i = 1,script.Parent.CD.Value-1 do
script.Parent.Name -= 1
task.wait(1)
end
CD = false
script.Parent.Name = Name
end
end
end
end)
I figured it out, after you said that I went to go check if it was or not. Then I remembered i set the key value in a server script, not a local one. Thanks!