#Debounce

1 messages · Page 1 of 1 (latest)

pine holly
#

I want to add a cooldown to this but I can't figure it out

thick solar
#

i got u

#
local Cooldown = false -- this is ur cooldown lol
local CooldownTime = 5 -- this is ur cooldown time lol

-- so when u call dat funciton u set it to true

script.Parent.OnServerEvent:Connect(function(Player)
if Cooldown then return end
Cooldown = true
-- the rest of your code
--[[
  aosjhdakljhdsna
akosjdhakjdsh
aksjdhakjsdh
akosjdhaksjd


]]
-- after your code logic ends

task.wait(CooldownTime)
Cooldown = false 

end)
pine holly
#

There's no errors but somehow it dosen't work

thick solar
#

show how u did it

#

oops

humble tusk
thick solar
#

try it now

#

brah

#

hold on brudder

#

let him figure out the single one

pine holly
thick solar
#

the player specific is just a table

humble tusk
#

Reasonable

thick solar
#

that was my bad

#

it should work then

humble tusk
thick solar
#

just set it to nil

#

CooldownTable[player] = nil

#

das it

pine holly
#

still dosen't work

humble tusk
#

Oh right

thick solar
#

lemme look over it more

#

wjhat the fck

#

LMAO

#

BRo

#

U didnt need to copy my stuff liek dat LOL

#

U just needed to add the if statment

#

send ur code

#

in text lmfao

pine holly
thick solar
#

send ur script

#

i'll show u how to do it

pine holly
#

I can't

thick solar
#

send it here in the chat

pine holly
#

it's over the limit

thick solar
#

just send dat part

pine holly
#

nvm

thick solar
#
local TweeningInfo = TweenInfo.new(3,Enum.EasingStyle.Quint,Enum.EasingDirection.Out,0,false,0)
local IsEmpty = false
local Cooldown = false
local CooldownTime = 5
script.Parent.OnServerEvent:Connect(function(Player)
        if Cooldown then return end
        Cooldown = true
    if IsEmpty == false then
        local Height = {Value = Player.Character.Humanoid.BodyHeightScale.Value * 2}
        local Depth = {Value = Player.Character.Humanoid.BodyDepthScale.Value * 2}
        local Width = {Value = Player.Character.Humanoid.BodyWidthScale.Value * 2}
        local Head = {Value = Player.Character.Humanoid.HeadScale.Value * 2}
        local WdithTween = game:GetService("TweenService"):Create(Player.Character.Humanoid.BodyWidthScale,TweeningInfo,Width)
        local HeightTween = game:GetService("TweenService"):Create(Player.Character.Humanoid.BodyHeightScale,TweeningInfo,Height)
        local DepthTween = game:GetService("TweenService"):Create(Player.Character.Humanoid.BodyDepthScale,TweeningInfo,Depth)
        local HeadTween = game:GetService("TweenService"):Create(Player.Character.Humanoid.HeadScale,TweeningInfo,Head)
        WdithTween:Play()
        HeightTween:Play()
        DepthTween:Play()
        HeadTween:Play()
        Player.Character.Humanoid.JumpPower = Player.Character.Humanoid.JumpPower * 1
        wait(15)
        local Height = {Value = Player.Character.Humanoid.BodyHeightScale.Value / 2}
        local Depth = {Value = Player.Character.Humanoid.BodyDepthScale.Value / 2}
        local Width = {Value = Player.Character.Humanoid.BodyWidthScale.Value / 2}
        local Head = {Value = Player.Character.Humanoid.HeadScale.Value / 2}
        local WdithTween = game:GetService("TweenService"):Create(Player.Character.Humanoid.BodyWidthScale,TweeningInfo,Width)
        local HeightTween = game:GetService("TweenService"):Create(Player.Character.Humanoid.BodyHeightScale,TweeningInfo,Height)
        local DepthTween = game:GetService("TweenService"):Create(Player.Character.Humanoid.BodyDepthScale,TweeningInfo,Depth)
        local HeadTween = game:GetService("TweenService"):Create(Player.Character.Humanoid.HeadScale,TweeningInfo,Head)
        WdithTween:Play()
        HeightTween:Play()
        DepthTween:Play()
        HeadTween:Play()
        Player.Character.Humanoid.JumpPower = Player.Character.Humanoid.JumpPower * 1.2
    end

        task.wait(CooldownTime)
        Cooldown = false
end)
#

it might be formatted weird

#

but that works

pine holly
#

thanks bro!!

thick solar
#

yw

#

that will be 230k robux plz

#

cmon

pine holly
#

damnnnnnnnnnnn

thick solar
#

cuff it up

#

cuff it up

#

🖐️

pine holly
#

also

#

you know why it does this wierd thing?

#

it's not anchored

thick solar
#

idk

#

that usually happens when its anchored

pine holly
#

ik but it's not

thick solar
#

idk man

#

looks pretty welded to me

#

i mean

#

anchored

pine holly
#

NVM im stupid the script made it anchored