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

My press E system not working, why ?

Asked by
Tusi_1 17
4 years ago
Edited 4 years ago

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)

0
Call print(ASD) before the conditional to see if ASD is preventing the code from running Ziffixture 6913 — 4y

1 answer

Log in to vote
0
Answered by
Lakodex 711 Moderation Voter
4 years ago

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)
0
This is what he's saying. To change line 20 to. if keyCode.KeyCode == Enum.KeyCode.E then killerbrenden 1537 — 4y
0
or is this not printing ! Tusi_1 17 — 4y
Ad

Answer this question