The full script is really long. Its also a mess because Im still working on it. but here it is:
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character.Humanoid
local statusFolder = character:WaitForChild("StatusFolder")
local uis = game:GetService("UserInputService")
local ts = game:GetService("TweenService")
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Whitelist
params.FilterDescendantsInstances = {workspace.Map}
local remote = game.ReplicatedStorage.CombatEvent
local LastTimeM1 = 0
local LastM1End = 0
local combo = 1
local blocking = false
local canAir = true
local punchAnims = {
"rbxassetid://11967384879",
"rbxassetid://11965741396",
"rbxassetid://11968253783",
"rbxassetid://11978496178",
"rbxassetid://11978551893",
}
local blockAnims = {
"rbxassetid://11991966762"
}
local airAnims = {
"rbxassetid://11968348350",
"rbxassetid://11969785324"
}
local UserInputService = game:GetService("UserInputService")
local localPlayer = game.Players.LocalPlayer
local canDoubleJump = false
local hasDoubleJumped = false
local oldPower
local TIME_BETWEEN_JUMPS = 0.2
local DOUBLE_JUMP_POWER_MULTIPLIER = 1.4
function onJumpRequest()
if not character or not humanoid or not character:IsDescendantOf(workspace) or
humanoid:GetState() == Enum.HumanoidStateType.Dead then
return
end
if canDoubleJump and not hasDoubleJumped then
hasDoubleJumped = true
humanoid.JumpPower = oldPower * DOUBLE_JUMP_POWER_MULTIPLIER
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end
end
local function isinparty(plr, hit)
for i,v in pairs(game.Players:GetChildren()) do
if v:FindFirstChild("Party") then
if v:FindFirstChild("Party"):FindFirstChild(plr) and v:FindFirstChild("Party"):FindFirstChild(hit) then
return true
end
end
end
end
local function characterAdded(newCharacter)
character = newCharacter
humanoid = newCharacter:WaitForChild("Humanoid")
hasDoubleJumped = false
canDoubleJump = false
oldPower = humanoid.JumpPower
humanoid.StateChanged:connect(function(old, new)
if new == Enum.HumanoidStateType.Landed then
canDoubleJump = false
hasDoubleJumped = false
humanoid.JumpPower = oldPower
elseif new == Enum.HumanoidStateType.Freefall then
wait(TIME_BETWEEN_JUMPS)
canDoubleJump = true
end
end)
end
if localPlayer.Character then
characterAdded(localPlayer.Character)
end
local function hb(size, cframe, ignore, char)
local hb = Instance.new("Part", workspace.Fx)
hb.Anchored = true
hb.CanCollide = false
hb.Transparency = 0.6
hb.Name = "hb"
hb.Material = Enum.Material.ForceField
hb.CanQuery = false
hb.Size = size
hb.CFrame = cframe
local con
con = hb.Touched:Connect(function()
con:Disconnect()
end)
local lasttarg
for i,v in pairs(hb:GetTouchingParts()) do
if v.Parent:FindFirstChild("Humanoid") and table.find(ignore, v.Parent) == nil then
if lasttarg then
if (lasttarg.Position - char.PrimaryPart.Position).Magnitude > (v.Position - char.PrimaryPart.Position).Magnitude then
lasttarg = v.Parent.PrimaryPart
end
else
lasttarg = v.Parent.PrimaryPart
end
end
end
hb:Destroy()
if lasttarg then
return lasttarg.Parent
else
return nil
end
end
local function crater(data)
local currentTime = tick()
local craterRaycastResult
repeat
craterRaycastResult = workspace:Raycast(data.Target.PrimaryPart.Position, data.Direction, params)
print(craterRaycastResult)
wait()
until tick() - currentTime > 5 or craterRaycastResult ~= nil
if craterRaycastResult then
for i = 0, data.Count do
local part = Instance.new("Part", workspace.Fx)
part.BottomSurface = part.LeftSurface
part.TopSurface = part.LeftSurface
part.Size = Vector3.new(4, math.random(10,20)/10, math.random(10,20)/10)
part.Anchored = true
part.CFrame = CFrame.new(craterRaycastResult.Position, craterRaycastResult.Position +craterRaycastResult.Normal)
part.CFrame = part.CFrame * CFrame.Angles(math.rad(90), math.rad(i * 360/data.Count), 0) * CFrame.new(0,0,data.Size*-2) * CFrame.Angles(math.rad(35),0,0)
part.CanQuery = false
part.CanCollide = false
part.CanTouch = false
local result = workspace:Raycast(part.Position + craterRaycastResult.Normal * 4, craterRaycastResult.Normal * -10, params)
if result then
part.Position = result.Position
part.Material = result.Material
part.Color = result.Instance.Color
else
part:Destroy()
end
part.Position = part.Position + craterRaycastResult.Normal * -4
ts:Create(part, TweenInfo.new(0.2, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out, 0, false, 0), {Position = part.Position + craterRaycastResult.Normal * 4}):Play()
spawn(function()
game.Debris:AddItem(part, 4)
wait(3)
ts:Create(part, TweenInfo.new(0.5, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out, 0, false, 0), {Position = part.Position + craterRaycastResult.Normal * -4}):Play()
end)
if i % 3 < 2 and result then
local rubble = part:Clone()
rubble.Size = Vector3.new(math.random(20,40)/20, math.random(20,40)/20, math.random(20,40)/20)
rubble.Position = result.Position + craterRaycastResult.Normal * 4
rubble.Material = result.Material
rubble.Color = result.Instance.Color
rubble.Parent = workspace.Fx
rubble.Anchored = false
rubble.CanCollide = true
local bv = Instance.new("BodyVelocity", rubble)
bv.Velocity = Vector3.new(math.random(-40,40), 30, math.random(-40,40))
bv.MaxForce = Vector3.new(99999,99999,99999)
bv.Name = "Velocity"
game.Debris:AddItem(bv, 1)
game.Debris:AddItem(rubble, 4)
spawn(function()
wait(2)
ts:Create(rubble, TweenInfo.new(1, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out, 0, false, 0), {Transparency = 1}):Play()
end)
rubble.Transparency = 0
end
end
-- shockwave--
end
end
local function finisher(data)
local cf = data.Character.PrimaryPart.CFrame
for i = 1,40 do
local rock = Instance.new("Part")
rock.Size = Vector3.new(math.random(10,20)/10,math.random(10,20)/10,math.random(10,20)/10)
rock.CFrame = cf * CFrame.new(3,0,-4 + (i * -1))
rock.CanCollide = false
rock.Anchored = true
local result = workspace:Raycast(rock.Position, Vector3.new(0, -4, 0), params)
if result then
rock.Position = result.Position+Vector3.new(0,0.25,0)
rock.Material = result.Material
rock.Color = result.Instance.Color
rock.Rotation = Vector3.new(math.random(0,180), math.random(0,180), math.random(0,180))
rock.Parent = workspace.Fx
game.Debris:AddItem(rock, 2)
else
rock:Destroy()
end
local rock = Instance.new("Part")
rock.Size = Vector3.new(math.random(10,20)/10,math.random(10,20)/10,math.random(10,20)/10)
rock.CFrame = cf * CFrame.new(-3,0,-4 + (i * -1))
rock.Anchored = true
local result = workspace:Raycast(rock.Position, Vector3.new(0,-4,0), params)
if result then
rock.Position = result.Position+Vector3.new(0,0.25,0)
rock.Material = result.Material
rock.Color = result.Instance.Color
rock.Rotation = Vector3.new(math.random(0,180), math.random(0,180), math.random(0,180))
rock.Parent = workspace.Fx
game.Debris:AddItem(rock,2)
else
rock:Destroy()
end
if i == 40 then
for n = 1,4 do
local rock = Instance.new("Part")
rock.Size = Vector3.new(math.random(10,20)/10,math.random(10,20)/10,math.random(10,20)/10)
rock.CFrame = cf * CFrame.new(3 - (n/1.5), 0, -45 + (n * -0.5))
rock.CanCollide = false
rock.Anchored = true
local result = workspace:Raycast(rock.Position, Vector3.new(0,-4,0), params)
if result then
rock.Position = result.Position+Vector3.new(0,0.25,0)
rock.Material = result.Material
rock.Color = result.Instance.Color
rock.Rotation = Vector3.new(math.random(0,180), math.random(0,180), math.random(0,180))
rock.Parent = workspace.Fx
game.Debris:AddItem(rock, 2)
else
rock:Destroy()
end
local rock = Instance.new("Part")
rock.Size = Vector3.new(math.random(10,20)/10,math.random(10,20)/10,math.random(10,20)/10)
rock.CFrame = cf * CFrame.new(-3 + (n/2), 0, -45 + (n * -0.5))
rock.CanCollide = false
rock.Anchored = true
local result = workspace:Raycast(rock.Position, Vector3.new(0,-4,0), params)
if result then
rock.Position = result.Position+Vector3.new(0,0.25,0)
rock.Material = result.Material
rock.Color = result.Instance.Color
rock.Rotation = Vector3.new(math.random(0,180), math.random(0,180), math.random(0,180))
rock.Parent = workspace.Fx
game.Debris:AddItem(rock, 2)
else
rock:Destroy()
end
end
end
if i % 6 == 0 then
wait()
end
end
end
uis.InputBegan:Connect(function(input, gpe)
print(input.UserInputType)
local playergui = game.Players.LocalPlayer.PlayerGui
if gpe then return end
if input.UserInputType == Enum.UserInputType.MouseButton1 then
if playergui.ToolsGui:FindFirstChild("Center"):FindFirstChild("Weapon") or #playergui.ToolsGui.Center:FindFirstChildOfClass("ViewportFrame"):GetChildren() == 0 then
if tick() - LastTimeM1 >0.3 and tick() - LastM1End >0.7 and not blocking and statusFolder:FindFirstChild("Stun") == nil then
if tick() - LastTimeM1 > 0.7 then
combo = 1
canAir = true
canDoubleJump = true
end
LastTimeM1 = tick()
local animation = Instance.new("Animation", workspace.Fx)
local air = nil
local animfolder
local weapon
for i,v in pairs(game.Players.LocalPlayer.EquippedItems:GetChildren()) do
for l,m in pairs(game.ReplicatedStorage.Items:GetChildren()) do
if m:FindFirstChild(v.Name) then
if m:FindFirstChild(v.Name).Info:FindFirstChild("Type").Value == "Weapon" then
if playergui.ToolsGui.Center:FindFirstChildOfClass("ViewportFrame"):FindFirstChild(v.Name) then
weapon = v.Name
end
end
end
end
end
if weapon ~= nil then
animfolder = game.ReplicatedStorage.Animations:FindFirstChild(weapon)
else
animfolder = game.ReplicatedStorage.Animations.HandCombat
end
if uis:IsKeyDown("Space") and combo == 4 and canAir == true then
canAir = false
animation.AnimationId = animfolder:FindFirstChild("AirAnims"):FindFirstChild("1").AnimationId
air = "Up"
elseif not uis:IsKeyDown("Space") and combo == 5 and canAir == false then
animation.AnimationId = animfolder:FindFirstChild("AirAnims"):FindFirstChild("2").AnimationId
air = "Down"
else
animation.AnimationId = animfolder:FindFirstChild("PunchAnims"):FindFirstChild(combo).AnimationId
end
local load = humanoid:LoadAnimation(animation)
load:Play()
animation:Destroy()
local hb = Instance.new("Part", workspace.Fx)
hb.Anchored = true
hb.CanCollide = false
hb.Transparency = 0.6
hb.Name = "hb"
hb.Material = Enum.Material.ForceField
hb.CanQuery = false
hb.Size = animfolder:FindFirstChild("Info"):FindFirstChild("HitBoxSize").Value
hb.CFrame = character.PrimaryPart.CFrame*CFrame.new(0,-6,-3)
local con
con = hb.Touched:Connect(function()
con:Disconnect()
end)
for i,v in pairs(hb:GetTouchingParts()) do
if v.Parent:FindFirstChild("Humanoid") and table.find({character}, v.Parent) == nil then
if v == v.Parent.PrimaryPart and v.Parent.Humanoid.Health > 0 then
local inparty = isinparty(game.Players.LocalPlayer.Name, v.Parent.Name)
if not inparty then
local data = {
["Target"] = v.Parent,
["Character"] = character,
["Combo"] = combo,
["Air"] = air,
["Action"] = "m1",
}
remote:FireServer(data)
print("Yo we gotta hit", combo, air, v.Parent.Humanoid.Health)
local attacking = Instance.new("IntValue", character.StatusFolder)
attacking.Name = "Attacking"
game.Debris:AddItem(attacking,0.4)
end
end
end
end
hb:Destroy()
if combo == #punchAnims then
combo = 1
LastM1End = tick()
else
combo += 1
canDoubleJump = false
end
humanoid.WalkSpeed = 0
wait(0.4)
humanoid.WalkSpeed = 16
end
elseif #playergui.ToolsGui.Center:FindFirstChildOfClass("ViewportFrame"):GetChildren() >= 1 then
game.ReplicatedStorage.Interact:FireServer(playergui.ToolsGui.Center:FindFirstChildOfClass("ViewportFrame"):GetChildren()[1].Name)
print("fired")
end
elseif input.KeyCode == Enum.KeyCode.F and tick() - LastTimeM1 > 0.3 and statusFolder:FindFirstChild("Stun") == nil then
print("fff")
blocking = true
local animation = Instance.new("Animation", workspace.Fx)
animation.AnimationId = blockAnims[1]
local blockanimation = humanoid.Animator:LoadAnimation(animation)
blockanimation:Play()
animation:Destroy()
local data = {
["Action"] = "Block",
["Character"] = character
}
remote:FireServer(data)
repeat
wait()
until blocking == false or statusFolder:FindFirstChild("Stun")
blocking = false
blockanimation:Stop()
elseif input.KeyCode == Enum.KeyCode.E and statusFolder:FindFirstChild("Stun") == nil then
local hitTarg = hb(Vector3.new(4,6,4), character.PrimaryPart.CFrame * CFrame.new(0,0,-3), {character}, character)
if hitTarg then
local data = {
["Action"] = "Grip",
["Character"] = character,
["Target"] = hitTarg
}
remote:FireServer(data)
end
end
end)
uis.InputEnded:Connect(function(input, gpe)
if input.KeyCode == Enum.KeyCode.F and blocking then
blocking = not blocking
local data = {
["Action"] = "Unblock",
["Character"] = character
}
remote:FireServer(data)
end
end)
remote.OnClientEvent:Connect(function(data)
if data.Action == "Crater" then
crater(data)
elseif data.Action == "Finisher" then
finisher(data)
elseif data.Action == "Block" then
end
end)
statusFolder.ChildAdded:Connect(function(Child)
local WalkSpeed = 16
local JumpHeight = 7.2
character.PrimaryPart.Anchored = false
for i,status in pairs(statusFolder:GetChildren()) do
if status.Name == "Stun" then
WalkSpeed = 0
JumpHeight = 0
elseif status.Name == "Block" then
WalkSpeed = 3
JumpHeight = 3.6
end
end
humanoid.WalkSpeed = WalkSpeed
humanoid.JumpHeight = JumpHeight
end)
statusFolder.ChildRemoved:Connect(function(Child)
local WalkSpeed = 16
local JumpHeight = 7.2
character.PrimaryPart.Anchored = false
if blocking then
WalkSpeed = 0
JumpHeight = 0
end
for i,status in pairs(statusFolder:GetChildren()) do
if status.Name == "Stun" then
WalkSpeed = 0
JumpHeight = 0
elseif status.Name == "Block" then
WalkSpeed = 3
JumpHeight = 3.6
end
end
humanoid.WalkSpeed = WalkSpeed
humanoid.JumpHeight = JumpHeight
end)
humanoid.StateChanged:Connect(function(old, new)
if new == Enum.HumanoidStateType.Landed then
canAir = true
end
end)
uis.JumpRequest:Connect(function()
if tick() - LastTimeM1 < 1 then
humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
else
humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
end
end)
localPlayer.CharacterAdded:connect(characterAdded)
UserInputService.JumpRequest:connect(onJumpRequest)
sorry its so messy, I plan on cleaning it up