--Variables--
local players = game:GetService("Players")
local player = players.LocalPlayer or players.PlayerAdded:Wait()
local mouse = player:GetMouse()
local UIS = game:GetService("UserInputService")
local repStorage = game:GetService("ReplicatedStorage")
local critEvent = repStorage:WaitForChild("CritEvent")
local verify1 = false
local verify2 = false
local timesUp = true
--Function--
local function event(input, gameProccess)
if gameProccess then return end
if input.KeyCode == Enum.KeyCode.Q then
verify1 = true
local time1 = tick()
return time1
end
end
local function event2(input, gameProccess)
if gameProccess then return end
mouse.Button1Down:Connect(function()
verify2 = true
local time2 = tick()
return time2
end)
end
--Event--
UIS.InputBegan:Connect(function(input, gameProccess)
local time3 = tick()
local time1 = event(input, gameProccess)
local time2 = event2(input, gameProccess)
if verify1 and verify2 then
timesUp = false
for i = 1, 3, 1 do
if i == 3 then
timesUp = true
end
if not timesUp and verify1 and verify2 then
critEvent:FireServer()
verify1 = false
verify2 = false
end
end
end
end)
UIS.InputEnded:Connect(function()
end)
local players = game:GetService("Players")
local player = players.LocalPlayer or players.PlayerAdded:Wait()
local mouse = player:GetMouse() --mouse
local repStorage = game:GetService("ReplicatedStorage")
local punchEvent = repStorage:WaitForChild("PunchEvent")
mouse.Button1Down:Connect(function() --mouse clicked
punchEvent:FireServer(mouse) --tell server
end)
local debounce = false
local debounce2 = false
local combo = 1
local crit = false
local hitalready = false
local punching = false
--Remotes--
local repStorage = game:GetService("ReplicatedStorage")
local critEvent = repStorage:WaitForChild("CritEvent")
local punchEvent = repStorage:WaitForChild("PunchEvent")
--Create Animation--
local animation = repStorage:WaitForChild("Animation")
local animation2 = repStorage:WaitForChild("Animation2")
critEvent.OnServerEvent:Connect(function(player)
crit = true
wait(1)
crit = false
end)
punchEvent.OnServerEvent:Connect(function(player, mouse)
punching = true
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
if combo == 1 then
if debounce then
return
end
debounce = true
local animationTrack = animator:LoadAnimation(animation)
animationTrack:Play()
task.wait(1)
combo = 2
animationTrack:Stop()
debounce = false
elseif combo == 2 then
if debounce then
return
end
debounce = true
local animationTrack = animator:LoadAnimation(animation2)
animationTrack:Play()
wait(1)
combo = 1
animationTrack:Stop()
debounce = false
end
character:WaitForChild("LeftHand").Touched:Connect(function(touch)
if touch.Parent:FindFirstChild("HumanoidRootPart") and not hitalready and punching and not touch.Parent == character and not touch.Parent.Name == character.Name then
if crit then
if debounce2 then
return
end
debounce2 = true
local hum = touch.Parent:WaitForChild("Humanoid")
hum.Health -= 20
local Tagged = Instance.new("ObjectValue")
Tagged.Name = "creator"
Tagged.Value = player
Tagged.Parent = hum
task.wait(1)
debounce2 = false
crit = false
hitalready = true
task.wait(1)
hitalready = false
punching = false
elseif not crit then
if debounce2 then
return
end
debounce2 = true
local hum = touch.Parent:WaitForChild("Humanoid")
hum.Health -= 10
local Tagged = Instance.new("ObjectValue")
Tagged.Name = "creator"
Tagged.Value = player
Tagged.Parent = hum
hitalready = true
task.wait(1)
debounce2 = false
punching = false
hitalready = false
end
end
end)
character:WaitForChild("RightHand").Touched:Connect(function(touch)
if touch.Parent:FindFirstChild("HumanoidRootPart") and not hitalready and punching and not touch.Parent == character and not touch.Parent.Name == character.Name then
if crit then
if debounce2 then
return
end
debounce2 = true
local hum = touch.Parent:WaitForChild("Humanoid")
hum.Health -= 20
local Tagged = Instance.new("ObjectValue")
Tagged.Name = "creator"
Tagged.Value = player
Tagged.Parent = hum
task.wait(1)
debounce2 = false
crit = false
hitalready = true
task.wait(1)
hitalready = false
punching = false
elseif not crit then
if debounce2 then
return
end
debounce2 = true
local hum = touch.Parent:WaitForChild("Humanoid")
hum.Health -= 10
local Tagged = Instance.new("ObjectValue")
Tagged.Name = "creator"
Tagged.Value = player
Tagged.Parent = hum
hitalready = true
task.wait(1)
debounce2 = false
punching = false
hitalready = false
end
end
end)
end)
Use these 3 and test with a dummy (make sure it has all the child instances a regular player would).
It very much works! I had to change up some stuff and there it is! It works!
Here is the script i changed:
local debounce = false
local debounce2 = false
local combo = 1
local crit = false
local hitalready = false
local punching = false
--Remotes--
local repStorage = game:GetService("ReplicatedStorage")
local critEvent = repStorage:WaitForChild("CritEvent")
local punchEvent = repStorage:WaitForChild("PunchEvent")
--Create Animation--
local animation = repStorage:WaitForChild("Animation")
local animation2 = repStorage:WaitForChild("Animation2")
critEvent.OnServerEvent:Connect(function(player)
crit = true
wait(1)
crit = false
end)
punchEvent.OnServerEvent:Connect(function(player, mouse)
punching = true
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
if combo == 1 then
if debounce then
return
end
debounce = true
local animationTrack = animator:LoadAnimation(animation)
animationTrack:Play()
task.wait(1)
combo = 2
animationTrack:Stop()
debounce = false
elseif combo == 2 then
if debounce then
return
end
debounce = true
local animationTrack = animator:LoadAnimation(animation2)
animationTrack:Play()
wait(1)
combo = 1
animationTrack:Stop()
debounce = false
end
character:WaitForChild("LeftHand").Touched:Connect(function(touch)
print('A1')
if touch.Parent:FindFirstChild("HumanoidRootPart") and not hitalready and punching then
print("nah")
if touch.Parent ~= character then
print("a")
if crit then
if debounce2 then
return
end
debounce2 = true
local hum = touch.Parent:WaitForChild("Humanoid")
hum.Health -= 20
local Tagged = Instance.new("ObjectValue")
Tagged.Name = "creator"
Tagged.Value = player
Tagged.Parent = hum
task.wait(1)
debounce2 = false
crit = false
hitalready = true
task.wait(1)
hitalready = false
punching = false
elseif not crit then
if debounce2 then
return
end
debounce2 = true
local hum = touch.Parent:WaitForChild("Humanoid")
hum.Health -= 10
local Tagged = Instance.new("ObjectValue")
Tagged.Name = "creator"
Tagged.Value = player
Tagged.Parent = hum
hitalready = true
task.wait(1)
debounce2 = false
punching = false
hitalready = false
end
end
end
end)
character:WaitForChild("RightHand").Touched:Connect(function(touch)
if touch.Parent:FindFirstChild("HumanoidRootPart") and not hitalready and punching and not touch.Parent == character and not touch.Parent.Name == character.Name then
if crit then
if debounce2 then
return
end
debounce2 = true
local hum = touch.Parent:WaitForChild("Humanoid")
hum.Health -= 20
local Tagged = Instance.new("ObjectValue")
Tagged.Name = "creator"
Tagged.Value = player
Tagged.Parent = hum
task.wait(1)
debounce2 = false
crit = false
hitalready = true
task.wait(1)
hitalready = false
punching = false
elseif not crit then
if debounce2 then
return
end
debounce2 = true
local hum = touch.Parent:WaitForChild("Humanoid")
hum.Health -= 10
local Tagged = Instance.new("ObjectValue")
Tagged.Name = "creator"
Tagged.Value = player
Tagged.Parent = hum
hitalready = true
task.wait(1)
debounce2 = false
punching = false
hitalready = false
end
end
end)
end)
Edit: now that im thinking about it im gonna test the crit one since there is no assurance it works
local debounce = false
local debounce2 = false
local combo = 1
local crit = false
local hitalready = false
local punching = false
--Remotes--
local repStorage = game:GetService("ReplicatedStorage")
local critEvent = repStorage:WaitForChild("CritEvent")
local punchEvent = repStorage:WaitForChild("PunchEvent")
--Create Animation--
local animation = repStorage:WaitForChild("Animation")
local animation2 = repStorage:WaitForChild("Animation2")
critEvent.OnServerEvent:Connect(function(player)
crit = true
wait(1)
crit = false
end)
punchEvent.OnServerEvent:Connect(function(player, mouse)
punching = true
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
if combo == 1 then
if debounce then
return
end
debounce = true
local animationTrack = animator:LoadAnimation(animation)
animationTrack:Play()
task.wait(1)
combo = 2
animationTrack:Stop()
debounce = false
elseif combo == 2 then
if debounce then
return
end
debounce = true
local animationTrack = animator:LoadAnimation(animation2)
animationTrack:Play()
wait(1)
combo = 1
animationTrack:Stop()
debounce = false
end
character:WaitForChild("LeftHand").Touched:Connect(function(touch)
print('A1')
if touch.Parent:FindFirstChild("HumanoidRootPart") and not hitalready and punching then
print("nah")
if touch.Parent ~= character then
print("a")
if crit then
if debounce2 then
return
end
debounce2 = true
local hum = touch.Parent:WaitForChild("Humanoid")
hum.Health -= 20
local Tagged = Instance.new("ObjectValue")
Tagged.Name = "creator"
Tagged.Value = player
Tagged.Parent = hum
task.wait(1)
debounce2 = false
crit = false
hitalready = true
task.wait(1)
hitalready = false
punching = false
elseif not crit then
if debounce2 then
return
end
debounce2 = true
local hum = touch.Parent:WaitForChild("Humanoid")
hum.Health -= 10
local Tagged = Instance.new("ObjectValue")
Tagged.Name = "creator"
Tagged.Value = player
Tagged.Parent = hum
hitalready = true
task.wait(1)
debounce2 = false
punching = false
hitalready = false
end
end
end
end)
character:WaitForChild("RightHand").Touched:Connect(function(touch)
if touch.Parent:FindFirstChild("HumanoidRootPart") and not hitalready and punching and not touch.Parent == character and not touch.Parent.Name == character.Name then
if crit then
if debounce2 then
return
end
debounce2 = true
local hum = touch.Parent:WaitForChild("Humanoid")
hum.Health -= 20
local Tagged = Instance.new("ObjectValue")
Tagged.Name = "creator"
Tagged.Value = player
Tagged.Parent = hum
task.wait(1)
debounce2 = false
crit = false
hitalready = true
task.wait(1)
hitalready = false
punching = false
elseif not crit then
if debounce2 then
return
end
debounce2 = true
local hum = touch.Parent:WaitForChild("Humanoid")
hum.Health -= 10
local Tagged = Instance.new("ObjectValue")
Tagged.Name = "creator"
Tagged.Value = player
Tagged.Parent = hum
hitalready = true
task.wait(1)
debounce2 = false
punching = false
hitalready = false
end
end
end)
end)
Dash script does not work but it could be just my laptop, ill try it on pc later and if it doesn’t work ill try debugging myself… Im curious though, for testing purposes how would i check or make sure that if i touch myself it wont damage myself? It doesnt right now but i really dont want killing myself and giving my friend a free kill, jokes aside, if i dont check it could ruin the game as people would just accidentally eliminate themselves while trying to attack someone, so how would i test if i touch myself it wont damage myself?
Those should be both checking the same things. Is right hand punch still working since that’s not been changed?
local debounce = false
local debounce2 = false
local combo = 1
local crit = false
local hitalready = false
local punching = false
--Remotes--
local repStorage = game:GetService("ReplicatedStorage")
local critEvent = repStorage:WaitForChild("CritEvent")
local punchEvent = repStorage:WaitForChild("PunchEvent")
--Create Animation--
local animation = repStorage:WaitForChild("Animation")
local animation2 = repStorage:WaitForChild("Animation2")
critEvent.OnServerEvent:Connect(function(player)
crit = true
wait(1)
crit = false
end)
punchEvent.OnServerEvent:Connect(function(player, mouse)
punching = true
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
if combo == 1 then
if debounce then
return
end
debounce = true
local animationTrack = animator:LoadAnimation(animation)
animationTrack:Play()
task.wait(1)
combo = 2
animationTrack:Stop()
debounce = false
elseif combo == 2 then
if debounce then
return
end
debounce = true
local animationTrack = animator:LoadAnimation(animation2)
animationTrack:Play()
wait(1)
combo = 1
animationTrack:Stop()
debounce = false
end
character:WaitForChild("LeftHand").Touched:Connect(function(touch)
if touch.Parent:FindFirstChild("HumanoidRootPart") and punching and not hitalready and not touch.Parent == character then
if crit then
if debounce2 then
return
end
debounce2 = true
local hum = touch.Parent:WaitForChild("Humanoid")
hum.Health -= 20
local Tagged = Instance.new("ObjectValue")
Tagged.Name = "creator"
Tagged.Value = player
Tagged.Parent = hum
task.wait(1)
debounce2 = false
crit = false
hitalready = true
task.wait(1)
hitalready = false
punching = false
elseif not crit then
if debounce2 then
return
end
debounce2 = true
local hum = touch.Parent:WaitForChild("Humanoid")
hum.Health -= 10
local Tagged = Instance.new("ObjectValue")
Tagged.Name = "creator"
Tagged.Value = player
Tagged.Parent = hum
hitalready = true
task.wait(1)
debounce2 = false
punching = false
hitalready = false
end
end
end)
character:WaitForChild("RightHand").Touched:Connect(function(touch)
if touch.Parent:FindFirstChild("HumanoidRootPart") and punching and not hitalready and not touch.Parent == character then
if crit then
if debounce2 then
return
end
debounce2 = true
local hum = touch.Parent:WaitForChild("Humanoid")
hum.Health -= 20
local Tagged = Instance.new("ObjectValue")
Tagged.Name = "creator"
Tagged.Value = player
Tagged.Parent = hum
task.wait(1)
debounce2 = false
crit = false
hitalready = true
task.wait(1)
hitalready = false
punching = false
elseif not crit then
if debounce2 then
return
end
debounce2 = true
local hum = touch.Parent:WaitForChild("Humanoid")
hum.Health -= 10
local Tagged = Instance.new("ObjectValue")
Tagged.Name = "creator"
Tagged.Value = player
Tagged.Parent = hum
hitalready = true
task.wait(1)
debounce2 = false
punching = false
hitalready = false
end
end
end)
end)
Ill definitely try that, i think the right hand is working so it could just be lagging last game (as i think i saw like 2k ping last time i checked and it didnt work)
Unless the thing that fixed it is:
the ‘~=’
Although the if statement is correct and would not make sense.
Im guessing that means i dont need to amymore… anyway, it works perfectly fine now… i must thank you for that! Its been like 10h and you are still helping, so thanks so much!!