like it takes about 2 seconds to make it function again
local UIS = game:GetService("UserInputService")
local LP = game:GetService("Players").LocalPlayer
local Character = LP.Character
local Hum = Character:WaitForChild("Humanoid")
local Tool = script.Parent
local Feint = Tool.Feinting
UIS.InputBegan:Connect(function(input)
local Anim1 = Hum:LoadAnimation(script.Parent["Feint Anim"])
if input.UserInputType == Enum.UserInputType.MouseButton2 then
Anim1:Play()
Feint:Play()
end
end)
i found a solution simply put and not db then next to mousebutton2 then
local UIS = game:GetService("UserInputService")
local LP = game:GetService("Players").LocalPlayer
local Character = LP.Character
local Hum = Character:WaitForChild("Humanoid")
local Tool = script.Parent
local Feint = Tool.FakeSlash
local db = false
UIS.InputBegan:Connect(function(input)
local Anim1 = Hum:LoadAnimation(script.Parent["Feint Anim"])
if input.UserInputType == Enum.UserInputType.MouseButton2 and not db then
db = true
Anim1:Play()
Feint:Play()
task.wait(2)
db = false
end
end)
I suggest you take a look at this topic, specifically the chapter 2.2
It basically solves your problem, but in a cleaner way.
No need for debounce.
local UIS = game:GetService("UserInputService")
local LP = game:GetService("Players").LocalPlayer
local Character = LP.Character
local Hum = Character:WaitForChild("Humanoid")
local Tool = script.Parent
local Feint = Tool.FakeSlash
local event = UIS.InputBegan
local function onInputBegan(input)
local Anim1 = Hum:LoadAnimation(script.Parent["Feint Anim"])
if input.UserInputType == Enum.UserInputType.MouseButton2 then
Anim1:Play()
Feint:Play()
task.wait(2) -- you could just use Anim1.Ended:Wait() or maybe Feint.Ended:Wait() depending on which is longer. Idk which is obviously
end
event:Once(onInputBegan)
end
event:Once(onInputBegan)
Best regards,
Pinker
2 Likes