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

Why is it that my "e" key isn't working when I pressed it?

My "e" key works before I added this in

local Player = game.Players.LocalPlayer
local char = Player.CharacterAdded:Wait(20)

Now ever since I added that code in to change the Player's Walkspeed (without changing their whole entire speed reseting like speed buffs) my "e" key doesn't work. Why is that happening? There was no error.

Mouse.KeyDown:connect(function(Key)
	if not Equipped then return end
	if string.lower(Key) == "e" then
		if ChargeReady then
			ChargeReady = false
			EE:Play()
			SG:SetCoreGuiEnabled("Backpack", false)
			char.Humanoid.WalkSpeed = char.Humanoid.WalkSpeed - 25
			char.Humanoid.JumpPower = char.Humanoid.JumpPower - 20
			wait(.533)
			Tool.Handle.GroundHit:Play()
			wait(.468)
-- it continues

1 comment

0

Yes, if I change the wait() on the char code, it doesn't even work at all

1 answer

✓ Accepted answer

Don't do KeyDown, go like this.

local UIS = game:GetService("UserInputService")
local function OnPress(input)
if input.KeyCode == Enum.KeyCode.E then
-- Do Code here,
	end
end)

(if you want to do a chat msg use .Chatted, and do string.lower to check if it's lower then function it.

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