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

How do I let players be able to bind a certain skill to a certain key?

Asked by 8 years ago

I'm currently working on an RPG with some skills and I want to make it so that players can bind skills to their preferred keys, however, I can't think of a way to make that happen. Here's what I have tried:

01local enabled = true
02local player = script.Parent.Parent
03local character = player.Character
04local uis = game:GetService("UserInputService")
05local pkey = script.PressedKey.Value
06local jutsulife = script.JutsuLife.Value
07local cooldown = script.Cooldown.Value
08 
09uis.InputBegan:connect(function(input, gpe)
10    if not gpe then
11        if input.UserInputType == Enum.UserInputType.Keyboard then
12            if input.KeyCode == pkey then
13                if enabled then
14                    enabled = false
15                    local animTrack = character.Humanoid:LoadAnimation(script.HandSigns)
View all 73 lines...

The script.PressedKey is a StringValue with the value "Enum.KeyCode.R", but when I press the 'R' button it doesn't work.

0
Is this all inside of a local script? Remember that with FilteringEnabled, local script changes will not replicate to the server. WingedHorizen201 124 — 8y
0
I am aware of that and no my game is not FilteringEnabled AdamFunMaker 35 — 8y

Answer this question