#My debounce wont debounce, script runs with no time limit

117 messages · Page 1 of 1 (latest)

stiff yew
lone ember
#

Your debounce implementation is wrong, find how to do it properly or read whatever you read again

tired furnace
#

remove every debouce and only have three

#

one is gonna be if debouce == false then debouce = true

#

then at the end of the first if statement debouce = false

#

and add a one wait at the end

shadow coyote
#

blackest code I've ever seen

brazen grove
#
local debounce = false
local function getsCalledAlot()
  if debounce then return end
  debounce = true
  --do stuf
  debounce = false
end
tired furnace
eternal pondBOT
#

studio** You are now Level 14! **studio

brazen grove
#

its just a single line if then

tired furnace
#

what does return do

brazen grove
#

it breaks the function

#

and goes back to wherever you called it from lol

tired furnace
#

does the lines under it still run

brazen grove
#

no

dull bolt
#

Which it will only if debounce is on

tired furnace
brazen grove
#

you could do it the other way

#

and wrap the code in the if then

#

but i think its cleaner to just return

dull bolt
brazen grove
#

lel

tired furnace
#

u can easily get s1

#

u can skid a code and still get it

dull bolt
brazen grove
eternal pondBOT
#

studio** You are now Level 3! **studio

brazen grove
#

lol no worries its a doozy i think

stiff yew
brazen grove
#

at that point tho probably better to seperate the stuff into multiple functions

brazen grove
#

ya i didnt read your code so lol

#

if you just got 1 button 1 debounce will do it

stiff yew
#

alright, how do i set the time in there just add a wait?

brazen grove
#

what do you need a time for

#

if you want like a cooldown duration or something

#

ya just slap in a wait before you change the debounce back

stiff yew
#

okay perfect

brazen grove
#

i've read task.wait is better

#

for w/e reason idk

stiff yew
#

whats the dif between task.wait and wait

brazen grove
#

truely don't know lol

stiff yew
#

ive been wondering forever

#

lol i just use both

brazen grove
#

probably one is luau and one is reg lua

#

thats just a random guess tho

stiff yew
#

@brazen grove

#

hows this look?

#

ima jus test idk why i asked xd

#

works perfect, ill remember that for next time thank you for helping me learn

brazen grove
stiff yew
#

hey @brazen grove i had a quick question

brazen grove
#

yo

stiff yew
#

i have this bilboard GUI adorned to a part, and i want to make it something you can press E for as well

#

How do i go about that?

brazen grove
#

same as a regular ui button

stiff yew
#

im not sure how to do it in general..

#

wasnt sure if it being adorned changed anything

#

should i go to dev hub?

brazen grove
#

simplest

#

probably be to just slap an invisible button over it

stiff yew
#

the button will also be clickable

#

will this interfere?

brazen grove
#

wdym

#

OH

#

you said press E

stiff yew
#

yes it both E and Click

brazen grove
#

you already got it clickable

#

okay ya

#

hmm

#

you could use proximity prompts for the quick and ez

stiff yew
#

how do those work?

brazen grove
#

basically if you get within range itlll listen for input

stiff yew
#

i could but i wanted to add a custom E UI

brazen grove
#

you can disable the gui with prox prompts

#

and set it to use w/e you want

stiff yew
#

i can change the time too?

brazen grove
stiff yew
brazen grove
#

yup

stiff yew
#

word

#

thanks again!

brazen grove
#

theres also the promptShown event too

#

if you wanted to change the ui

#

to indicate its like clickable or w/e

stiff yew
#

so can i disable the UI then make the time on it 0 so they can instant click?

#

then just add my script

brazen grove
#

i dont think the prox prompt has any sort of cooldown property anyways

stiff yew
#

instant E*

#

some make you sit there and hold E

#

does that ahve to be added

brazen grove
#

ya you can make them hold it

stiff yew
#

okay i see

brazen grove
#

but you dont have to

stiff yew
#

ill go try it out

#

would i add the promt to my part?

brazen grove
#

ya the prompt goes in the workspace somewhere

#

anyone can interact with it

#

but the code for it you want in a localscript

#

theres actually like a global proximityprompt detector thing you can use too

#

so you dont have ot reference the prompt itself

#

so if you did like proxPromptService.PromptTriggered:Connect(function(prompt, player) end)

#

that might be a bit much tho lol

#

for 1 night

stiff yew
#

@brazen grove got it working

#

dont ask why i didnt make a varriable

#

i do not know