How to Stop the m1 local script from keep doing m1s on stun.
i have a fucntion that checks if the player is stunned i have tried many ways to stop the m1 but it didnt work like i wanted to.
– My Script
local player = game.Players.LocalPlayer -- Player Varialbels
local UIS = game:GetService("UserInputService")
local RS = game:GetService("ReplicatedStorage")
--Variabels
local combo = 1
local Remote = RS.Remotes:WaitForChild("EventBlackLeg")
local Equiped = false
local debounce = false
local data = nil
-- Settings
local Cooldown = 0.5
-- Check if tools is equiped
script.Parent.Parent.Equipped:Connect(function()
Equiped = true
end)
script.Parent.Parent.Unequipped:Connect(function()
Equiped = false
end)
-- UserInput
UIS.InputBegan:Connect(function(input)
local character = player.Character
character:GetAttributeChangedSignal("Stunned"):Connect(function()
print("stunned")
end)
if input.UserInputType == Enum.UserInputType.MouseButton1 and Equiped == true and debounce == false then
if combo == 1 and debounce == false then
-- if the combo is 1
debounce = true
data = "Punch1"
Remote:FireServer(data)
combo = 2
print(combo..data)
wait(Cooldown)
debounce = false
elseif combo == 2 and debounce == false then -- if combo is 2
debounce = true
data = "Punch2"
Remote:FireServer(data)
combo = 3
print(combo..data)
wait(Cooldown)
debounce = false
elseif combo == 3 and debounce == false then
debounce = true
data = "Punch3"
Remote:FireServer(data)
combo = 4
print(combo..data)
wait(Cooldown)
debounce = false
elseif combo == 4 and debounce == false then
debounce = true
data = "Punch4"
Remote:FireServer(data)
combo = 5
print(combo..data)
wait(Cooldown)
debounce = false
elseif combo == 5 and debounce == false then
debounce = true
data = "Punch5"
Remote:FireServer(data)
combo = 1
print(combo..data)
wait(Cooldown)
debounce = false
end
end
end)