#script problem with debounce
1 messages · Page 1 of 1 (latest)
--game id
--your badge id
player touches part,
3rd conditional statement is true
hit.Parent:findfirstchild turns db to false
then when touched by another limb,
1st conditional runs and warns debounce is false and turns to true
all this loops
oh ok
gimme a sec
@cerulean furnace yeah it still doesnt work
lemme try something rq
what did u change
lot of limbs touch at same time causing db false to be printed many times
k you want me to use getpartsinpart?
what do you want to happen
no like how do you want debounce to work
tell me where you want to turn on and off
if they find the humanoid db will be turned to false
** You are now Level 1! **
k
ye then after some time db will be true again
can you send code
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)
alright gimme a few minutes
@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)
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"
can u send that code
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)
if EnableBadge==true then
bs:UserHasBadgeAsync(plr.UserId,badgeid)
end
OMG
IM SO STUPID
ITS AWARD BADGE
LMAO
u dum dum