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

OnTouch Debounce Including Sound?

Asked by 6 years ago

I would like to add A Debounce to this code, so that when I Touch the Part, The Gui will pop up, But when I Step off the Part, the GUI will dissapear, and the when I hit the E Key, When I am not on the part, It doesn't make any sound, Only when I'm on the part.

How do I do this? Heres The Script;

script.Parent.Enabled = false workspace.ShowGui.Touched:Connect(function(hit) if hit.Parent == game.Players.LocalPlayer.Character then script.Parent.Enabled = true end end)

local uis = game:GetService("UserInputService") uis.InputBegan:Connect(function(key,bool) if bool == false then if key.KeyCode == Enum.KeyCode.E then script.Parent.ClimbSE:Play() script.Parent.Enabled = false end end end)

Answer this question