I tried to fix this punching script but I keep encountering this problem no matter what I try.
I also keep getting this error:
15:35:03.460 Players.musman65.Backpack.Punching:21: attempt to index nil with ‘Connect’ - Client - Punching:21
local Player = game:GetService("Players").LocalPlayer
local rp = game:GetService("ReplicatedStorage")
local Punch = rp:WaitForChild("Punch")
local UIS = game:GetChildren("UserInputService")
local isActive = false
local debounce = false
local comSeq = ""
local currTime = 0
local prevTime = 0
local cds =
{
cd1 = .25;
cd2 = 1;
}
UIS.InputBegan:Connect(function(input, isTyping)
if isTyping then
return
elseif input.UserInputType == Enum.UserInputType.MouseButton1 then
if debounce == false then
debounce = true
currTime = os.clock()
local passTime = currTime - prevTime
if passTime < 1 then
comSeq = comSeq.."L"
if string.len(comSeq) > 3 then
comSeq = "L"
end
else
comSeq = "L"
end
Punch:FireServer(comSeq)
end
end
end)
Punch.OnClientEventConnect(function(canPunch)
if canPunch then
--Player has stand equipped
prevTime = currTime
wait(cds.cd1)
debounce = false
else
--Player doesn't have stand equipped
wait(cds.cd2)
debounce = false
end
end)