-
What do you want to achieve? I want the equipped value and the equipped event to change when the E key is pressed
-
What is the issue? When the E key is pressed it only changes the Equipped Value to true and when i press it again, it just prints out (“glock is chosen”) and neither Equipped or deequipped.
-
What solutions have you tried so far? I have tried to look for the solutions on the devforum, they were either completely irrelevant or did not match my problem directly. I have tried to debug the code too with prints but as you can see that did not work kind of.
UIS.InputBegan:Connect(function(input, gpe)
if input.KeyCode == Enum.KeyCode.E then
print("glock is chosen")
if cooldown == false then
cooldown = true
if Equipped == false then --equip the gun
print("equipped")
Equipped = true
GET_GUNEVENT:FireServer(Equipped)
else--deequip the gun
print("deequipped")
Equipped = false
GET_GUNEVENT:FireServer(Equipped)
end
task.wait(cooldown_value)
cooldown = true
end
end
end)