You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want this to work properly, just read the code.
What is the issue? Include screenshots / videos if possible!
For some reason it always fires “Quitar”. It is in a LocalScript.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I didn’t look for solutions.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local summon = false
serviceUIS.InputBegan:Connect(function(input, gpe)
if gpe then return end
local hum = character.Humanoid
if input.KeyCode == Enum.KeyCode.Q then
if summon == false then
summon = true
event:FireServer("Poner")
else
summon = false
event:FireServer("Quitar")
end
end
end)
I dont know what’s wrong with your code but here’s your solution:
local db = false
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input, GPE)
if not GPE then
if input.KeyCode == Enum.KeyCode.Q then
if db == false then
db = true
print("Activated")
else
db = false
print("Desactivated")
end
end
end
end)
I think it errors because of a variable maybe? like that “serviceUIS” or something is just making the code to get stuck in the activation code. if ths code doesn’t work for you then the problem is not here, but in the “event” that you fire with the Q, if you could show us the the code there maybe we could help you better with your problem orrr just try my solution and see if it works