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

WASD keys function like arrow keys?

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

✓ Accepted answer

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.

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.

2 comments

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.

0

No problems, Glad I could help you out!

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