#script problem with debounce

1 messages · Page 1 of 1 (latest)

rapid plank
signal dragon
#

--game id
--your badge id

cerulean furnace
rapid plank
#

gimme a sec

#

@cerulean furnace yeah it still doesnt work

#

lemme try something rq

cerulean furnace
rapid plank
#

yeah i dont rlly understand this shit

#

never happend before

cerulean furnace
rapid plank
cerulean furnace
rapid plank
#

it to tp you or give you back

#

badge

cerulean furnace
#

no like how do you want debounce to work

#

tell me where you want to turn on and off

rapid plank
#

if they find the humanoid db will be turned to false

ornate cryptBOT
#

studio** You are now Level 1! **studio

rapid plank
#

k

cerulean furnace
#

thats it

#

?

rapid plank
#

ye then after some time db will be true again

cerulean furnace
#

can you send code

rapid plank
#

script.Parent.Touched:Connect(function(hit)
-- debugging
if not hit.Parent then
if debugging then
warn("Couldnt find the player. -- ".. name)
end
end
-- the main script
print(db)
if db then
if hit.Parent then
if hit.Parent:FindFirstChild("Humanoid") then db=false
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
local tp = game:GetService("TeleportService")
local bs = game:GetService("BadgeService")
if EnableTeleport then
tp:TeleportAsync(id,plr)
end
if EnableBadge then
bs:UserHasBadgeAsync(plr.UserId,badgeid)
end
if not EnableBadge and not EnableTeleport then
if debugging then
warn("Both are unenabled -- "..name)
end
end
task.wait(0.15) -- cd for debounce
db=true return
end
end
end
end)

cerulean furnace
#

alright gimme a few minutes

cerulean furnace
#

@rapid plank okay back from dinner but ur code is already good

local debugging = true
local db = true

script.Parent.Touched:Connect(function(hit)
    -- debugging
    if not hit.Parent then
        if debugging then
            warn("Couldnt find the player. -- ".. name)
        end
    end
    -- the main script
    if db then
        db = false
        local parent = hit.Parent
        local humanoid = parent:FindFirstChild("Humanoid")
        local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
        local tp = game:GetService("TeleportService")
        local bs = game:GetService("BadgeService")
-- code here

        print("Touched")
        task.wait(1) -- cd for debounce
        db=true 
    end
end)

rapid plank
#

alright lets see

#

ok so like

#

ye it works but theres no error with the badge thingy

#

it should pop up if there is no id

#

like "0"

cerulean furnace
#

wym

#

which error

rapid plank
#

wait lemme try smth out rq

#

ok

#

so

#

badge giver doesnt work now

cerulean furnace
rapid plank
#

script.Parent.Touched:Connect(function(hit)
-- debugging
if not hit.Parent then
if debugging then
warn("Couldnt find the player. -- ".. name)
end
end
-- the main script
if db then
db = false
local parent = hit.Parent
local humanoid = parent:FindFirstChild("Humanoid")
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
local tp = game:GetService("TeleportService")
local bs = game:GetService("BadgeService")
-- code here
if EnableBadge==true then
bs:UserHasBadgeAsync(plr.UserId,badgeid)
end
if EnableTeleport==true then
tp:TeleportAsync(id,plr)
end
if not EnableBadge and not EnableTeleport then
if debugging then
warn("Both are disabled. -- "..name)
end
end

    print("Touched")
    task.wait(0.25) -- cd for debounce
    db=true 
end

end)

cerulean furnace
#

there is no badge giver there

rapid plank
#

OMG

#

IM SO STUPID

#

ITS AWARD BADGE

#

LMAO

cerulean furnace