If you don't understand what I mean from the title well, I want it so that when one player holds on a button all other moves cannot be played. Then when he lets go all other one's can be played but the Button that he played before is on a debounce. Thanks for helping me here is my script.:)
--Variables--
repeat wait() until game.Players.LocalPlayer.Character
local Player = game.Players.LocalPlayer
player = game:WaitForChild("Players")
local Mouse = Player:GetMouse()
local UIS = game:GetService("UserInputService")
local en = true
local ben = true
local char = Player.Character
local hum = Player.Character.Humanoid
local root = Player.Character.HumanoidRootPart
local Torso = char.Torso
local TweenService = game:GetService("TweenService")
tren = true
--Has begun pressing Q--
UIS.InputBegan:Connect(function(inputObject)
if inputObject.KeyCode==Enum.KeyCode.Q then
if not en then return end--Debounces--
if not ben then return end--Debounces--
if not tren then return end
ben = false--Debounces--
en = false--Debounces--
tren = false
Part = Instance.new("Part")
Part.Parent = game.Workspace
Part.Anchored = true
Part.CanCollide = false
Part.CFrame = root.CFrame * CFrame.new(0,0,-5)
Part.BrickColor = BrickColor.new("Really black")
wait()
ben = true
en = true
wait(5)
tren = true
end
end)
--Q has ended--
UIS.InputEnded:Connect(function(inputObject)
if inputObject.KeyCode==Enum.KeyCode.Q then
Part:Destroy()
end
end)
--E Has been press--
UIS.InputBegan:Connect(function(inputObject)
if inputObject.KeyCode==Enum.KeyCode.E then
if not en then return end--Debounces--
if not ben then return end--Debounces--
if not tren then return end
ben = false--Debounces--
tren = false--Debounces--
en = false
Part2 = Instance.new("Part")
Part2.Parent = game.Workspace
Part2.Anchored = true
Part2.CanCollide = false
Part2.CFrame = root.CFrame * CFrame.new(0,0,-5)
Part2.BrickColor = BrickColor.new("Really red")
wait()
ben = true
tren = true
wait(5)
en = true
end
--E has ended--
UIS.InputEnded:Connect(function(inputObject)
if inputObject.KeyCode==Enum.KeyCode.E then
Part2:Destroy()
end
end)
end)
