My debounce script seems to malfunction and it keeps printing the first argument, I don’t know how I could fix that if anyone has answer I’d be very grateful, thank you.
I haven’t touched lua in some time so I’m kind of in-experienced at the moment sorry for that.
GUIs.Button.MouseButton1Click:Connect(function()
local RemoteEvent = Seat:FindFirstChild("RemoteEvent") :: RemoteEvent
if not SeatInclination then
RemoteEvent:FireServer("Decline")
task.wait(1)
SeatInclination = true
else
RemoteEvent:FireServer("Incline")
task.wait(1)
SeatInclination = false
end
end)
Here’s the general format for a debounce like this:
local WAIT_TIME = 1
local debounce = false
GUIs.Button.MouseButton1Click:Connect(function()
if debounce then
return
end
debounce = true
-- add your code here
task.wait(WAIT_TIME)
debounce = false
end)
if not SeatInclination then
RemoteEvent:FireServer("Decline")
task.wait(1)
SeatInclination = true
else
RemoteEvent:FireServer("Incline")
task.wait(1)
SeatInclination = false
end
local remoteEvent = Seat:FindFirstChild("RemoteEvent") :: RemoteEvent
local WAIT_TIME = 1
local debounce = false
local inclined = false
GUIs.Button.MouseButton1Click:Connect(function()
if debounce then
return
end
debounce = true
remoteEvent:FireServer(inclined and "Decline" or "Incline")
inclined = not inclined
task.wait(WAIT_TIME)
debounce = false
end)