:Disconnect only seems to work outside the function, using it inside says “its not a valid member”.
Cant get :Once to work, and even if it would it would disconnect even when an invalid button was pressed.
:Disconnect only seems to work outside the function, using it inside says “its not a valid member”.
Cant get :Once to work, and even if it would it would disconnect even when an invalid button was pressed.
its because of the scope
define connection before
local connection
connection = someconnect:Connect(function()
connection:Disconnect()
end
Variables can only be referenced past their assignment operation; you’re attempting to use something that’s in the middle of being defined. Use forward declaration to make the variable’s existence known to the function:
local question
question = UserInputService.InputBegan:Connect(function(input: InputObject, gameProcessedEvent: boolean)
if gameProcessedEvent then
return
end
-- ...
end)
Still dont work
Nvm, it just wasnt autocrrectying so i thoguht it wouldnt work.