#cancel ability on m1

1 messages · Page 1 of 1 (latest)

faint pewter
#

im trying to make it so that when a player m1s, then an ability disables but im having issues ```lua
local uis = game:GetService("UserInputService")
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local flashstep = game.ReplicatedStorage:WaitForChild("flashsteps")
local flashstepOFF = game.ReplicatedStorage:WaitForChild("flashstepsOFF")

local debounce = false
local flashtepping = false

uis.InputBegan:Connect(function(input, gpe)
if input.KeyCode == Enum.KeyCode.Q and debounce == false and flashtepping == false and not gpe then
debounce = true
flashtepping = true
humanoid.WalkSpeed = 60
flashstep:FireServer()
while flashtepping == true do
if input.KeyCode == Enum.KeyCode.MouseLeftButton then
flashtepping = false
humanoid.WalkSpeed = 16
flashstepOFF:FireServer()
task.wait(1)
debounce = false
else
task.wait(2)
flashstepOFF:FireServer()
humanoid.WalkSpeed = 16
task.wait(1)
debounce = false
flashtepping = false
end
end
end
end)

any help? (this is a local script btw)
vivid lake
#

local uis = game:GetService("UserInputService")
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local flashstep = game.ReplicatedStorage:WaitForChild("flashsteps")
local flashstepOFF = game.ReplicatedStorage:WaitForChild("flashstepsOFF")

local debounce = false
local flashtepping = false

local function endFlashstep()
flashtepping = false
humanoid.WalkSpeed = 16
flashstepOFF:FireServer()
task.wait(1)
debounce = false
end

uis.InputBegan:Connect(function(input, gpe)
if input.KeyCode == Enum.KeyCode.Q and not debounce and not flashtepping and not gpe then
debounce = true
flashtepping = true
humanoid.WalkSpeed = 60
flashstep:FireServer()

    task.spawn(function()
        task.wait(2)
        if flashtepping then
            endFlashstep()
        end
    end)
end

end)

uis.InputBegan:Connect(function(input, gpe)
if input.UserInputType == Enum.UserInputType.MouseButton1 and flashtepping and not gpe then
endFlashstep()
end
end)

vivid lake