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

My press E system not working, why ?

I want make sys what changing one BoolVaue and this value changign one GUI what is turning to visible or this is another script ! If i press the E not working !!!

local Input = game:GetService("UserInputService")
local Int = workspace.IntGomb
local ASD = 1





script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid")then
		Int.Value = true
		ASD = 2
		
		else
	end

end)

Input.InputBegan:Connect(function(keyCode)
		if keyCode.keyCode == Enum.KeyCode.E then
			if ASD == 2 then
				print(ASD,keyCode)-- NOT PRINTING THIS + NOT WORKING !!!!
				
				
		end
    end			
end)

1 comment

0

Call print(ASD) before the conditional to see if ASD is preventing the code from running

1 answer

✓ Accepted answer

I see the Issue. When you used keycode.keycode You must put Keycode with capital K or it will not work! Fixed script

local Input = game:GetService("UserInputService")
local Int = workspace.IntGomb
local ASD = 1





script.Parent.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid")then
        Int.Value = true
        ASD = 2

        else
    end

end)

Input.InputBegan:Connect(function(keyCode)
        if keyCode.KeyCode == Enum.KeyCode.E then
            if ASD == 2 then
                print(ASD,keyCode)-- NOT PRINTING THIS + NOT WORKING !!!!


        end
    end         
end)

2 comments

0

This is what he's saying. To change line 20 to. if keyCode.KeyCode == Enum.KeyCode.E then

0

or is this not printing !

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