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

WASD keys function like arrow keys?

Asked by
Hero_ic 502 Moderation Voter
9 years ago

Is there a way I can make the WASD keys function like the arrow keys where the D,A key would make the player turn but not move while only the W and S would move. Is this possible?

IDK if I worded this right.

2 answers

Log in to vote
3
Answered by
ImageLabel 1541 Moderation Voter
9 years ago

I don't believe you can officially unbind individual keys. However, you can clear all descendants of the ControllerService, therefore completely revoking any sort of control the player would normally have on his character.


local ControllerService = game:GetService('ControllerService')
Controller:ClearAllChildren()

You could also just remove the HumanoidController, which is the container for or object that controls a player's Humanoid and it's movements.

local ControllerService = game:GetService('ControllerService')

for key, value in pairs(ControllerService:GetChildren()) do 
    if value:IsA('HumanoidController') then 
        value:Destroy()
    end
end

You could unbind the Jump and Dismount (whatever that is) as shown here, but I don't don't believe there are any other buttons/keys that you could unbind apart from those listed in the most recent link.

You could also go on a little further to create your own humanoid controller, which I doubt you would find as easy as working with and understanding this service.

Ad
Log in to vote
2
Answered by
KordGamer 155
9 years ago

Hi KiHeros,

I do not think that this is possible, But you could try to do some key-binding like *PlaceRebuilder * did with his new game : Martial Heroes.

You can always do something like this :

Player = game.Players.LocalPlayer
Mouse = Player:GetMouse()




function OnKeyDown(key)
    if (key == 'whateverkey') then --This is the part you can fiddle around with.
       --Your code goes here
      end
end

Mouse.KeyDown:connect(OnKeyDown)

Sorry that I couldn't 100% help with this, But I hope I gave you some ideas.

Also, You can try disabling the WASD keys somehow, or just advising the players to use the arrow keys.

0
Thanks this gave me some ideas on how I can make this work, I think maybe by disabling the WASD keys and making it so that if you press D or A it rotates the player with script. Hero_ic 502 — 9y
0
No problems, Glad I could help you out! KordGamer 155 — 9y

Answer this question