Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i add a cooldown to this script?? Debounce isnt working for me [closed]

Asked by 7 years ago

local Bin = script.Parent local player = Bin.Parent.Parent function cloak(val) for i, v in pairs(player.Character:GetChildren()) do if v.ClassName == "Part" then v.Transparency = val elseif v.ClassName == "Hat" then v.Handle.Transparency = val end end player.Character.Head.face.Transparency = val end function onKeyDown(key) -- key functions

end

function onButton1Down(mouse) -- click left mouse button if player.Character.Head.Transparency == 0 then cloak(1) else cloak(0) end end

function onButton2Down(mouse) -- click right mouse button

end

function onButton1Up(mouse) -- release left button end

function onButton2Up(mouse) -- release right button

end

function onDeselected() -- when bin is unequipped cloak(0) end

function onSelected(mouse) -- when bin is equipped

mouse.Button1Down:connect(function() onButton1Down(mouse) end)
mouse.Button2Down:connect(function() onButton2Down(mouse) end)
mouse.Button2Up:connect(function() onButton2Up(mouse) end)
mouse.Button1Up:connect(function() onButton1Up(mouse) end)
mouse.KeyDown:connect(onKeyDown)

end

Bin.Selected:connect(onSelected) Bin.Deselected:connect(onDeselected)

1
Plz use code blocks on the whole script. KingLoneCat 2642 — 7y
0
Also, "Hat" is deprecated. They use "Accessories" now. animelover6446 41 — 7y

Closed as Non-Descriptive by TheeDeathCaster, Uroxus, pluginfactory, and TheHospitalDev

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?