repeat task.wait() until game:IsLoaded()
local players = game:GetService("Players")
local rs = game:GetService("ReplicatedStorage")
local uis = game:GetService("UserInputService")
local lp = players.LocalPlayer
local char = lp.Character or lp.CharacterAdded:Wait()
local hum:Humanoid = char:WaitForChild("Humanoid")
local hrp:Part = char:WaitForChild("HumanoidRootPart")
local Animator:Animator = hum:WaitForChild("Animator")
local Fightanims = rs.Assets.Animation.Combat.Fist
local HitboxPart = rs.Assets.Hitbox
local RemoteHitbox = rs.Assets.Remotes.Hitbox
local Block = Fightanims.Block
local Downslam = Fightanims.Downslam
local Uppercut = Fightanims.Uppercut
local anim = {
Animator:LoadAnimation(Fightanims.M1),
Animator:LoadAnimation(Fightanims.M1_2),
Animator:LoadAnimation(Fightanims.M1_3),
Animator:LoadAnimation(Fightanims.M1_4),
}
local BlockLoaded = Animator:LoadAnimation(Block)
local UppercutLoaded = Animator:LoadAnimation(Uppercut)
local Jumptick
local Isincombat = false
local current = 1
local now = tick()
local db = false
local DebounceChar = {}
local IsBlocking = false
local BlockWalkspeed = 10
local tool = script.Parent
function Hitbox(WhatType)
local current = HitboxPart:Clone()
current.Parent = workspace
current.CFrame = hrp.CFrame * CFrame.new(0,0,-2.5)
local Params = OverlapParams.new()
Params.FilterDescendantsInstances = {char,tool}
Params.FilterType = Enum.RaycastFilterType.Exclude
--local HitType = WhatType
print(WhatType)
task.spawn(function()
local s,e = pcall(function()
--print(WhatType)
for i,v in pairs(workspace:GetPartsInPart(current,Params)) do
if v.Parent:FindFirstChildOfClass("Humanoid") then
local echar:Model = v.Parent
local ehum = echar:FindFirstChildOfClass("Humanoid")
local ehrp:Part = echar:FindFirstChild("HumanoidRootPart")
if echar and not DebounceChar[echar] then
warn(WhatType)
warn(echar.Name)
if WhatType == "Uppercut" then
print(#workspace:GetPartsInPart(current,Params))
DebounceChar[echar] = true
RemoteHitbox:FireServer("Damage",echar,ehum,current,IsBlocking)
--ehrp.CFrame:Lerp(ehrp.CFrame * CFrame.new(0,2,2))
print("Succesfully done uppercut")
task.wait(.4)
--return ehum
else
DebounceChar[echar] = true
RemoteHitbox:FireServer("Damage",echar,ehum,current,IsBlocking)
task.wait(.4)
end
end
end
end
DebounceChar = {}
end)
if not s then
warn("Hitbox failed",e)
end
end)
game:GetService("Debris"):AddItem(current,.4)
end
tool.Activated:Connect(function()
if db == false and not IsBlocking and not char:GetAttribute("Stunned") then
db = true
local passedtime = tick() - now
if passedtime > 1 then
--print("Passed time?")
Isincombat = false
current = 1
now = tick()
db = false
else
if current <= 4 then
Isincombat = true
Jumptick = tick()
now = tick()
local a = anim[current]
Hitbox()
a:Play()
task.wait((a.Length - 0.2))
current += 1
if current == 5 and uis:IsKeyDown(Enum.KeyCode.Space) then
print("Has Tried to do uppercut")
UppercutLoaded.Priority = Enum.AnimationPriority.Action4
UppercutLoaded:Play()
Hitbox("Uppercut")
--print(ehum.Parent.Name)
task.wait(.8)
return
end
db = false
else
current = 1
now = tick()
task.wait(.45)
db = false
Isincombat = false
end
end
end
end)
uis.InputBegan:Connect(function(input, gpe)
if gpe then return end
if input.KeyCode == Enum.KeyCode.F then
IsBlocking = true
BlockLoaded:Play()
RemoteHitbox:FireServer("BlockOn")
hum.WalkSpeed = BlockWalkspeed
end
end)
uis.InputEnded:Connect(function(input, gpe)
if gpe then return end
if input.KeyCode == Enum.KeyCode.F then
IsBlocking = false
BlockLoaded:Stop()
RemoteHitbox:FireServer("Blockoff")
hum.WalkSpeed = 16
end
end)
uis.JumpRequest:Connect(function()
if Isincombat then
--print("Couldnt Jump")
hum.Jump = false
end
end)
--local testanim = workspace.Dummy.Humanoid.Animator:LoadAnimation(Uppercut)
--testanim.Looped = true
--testanim:Play()
At the hitbox function when i warn(whattype) it doesnt warn but before it does warn i tried to do everthing to fix it but it doesnt work. It returns constanly nil what ever i do.