Listen, I’m not a scripter but my friends jojo game was fun and it was broken but my friend didn’t want to fix it, so I decided to fix it with no experience with scripting.
you need to know Which one u wn to fire currently ur firing the folder u need to put a specific event to fire for example RemoteEvents.Punch:FireClient(player, false)
local module = {}
local TweenService = game:GetService("TweenService")
local meshes = script.Meshes
local remote = game.ReplicatedStorage.RemoteEvents.HeavyPunch
local Debris = game:GetService("Debris")
local hitAnims = script:FindFirstChild("Anims"):GetChildren()
local plrsHit = {}
local ServerScriptService = game:GetService("ServerScriptService")
local library = ServerScriptService:WaitForChild("Library")
local DH = require(library:WaitForChild("DictionaryHandler"))
function doDamage(character,humrp,folder)
local hitbox = meshes:WaitForChild("Hitbox"):Clone()
hitbox.CFrame = humrp.CFrame * CFrame.new(0,0,-2)
hitbox.Parent = folder
local weld = Instance.new("ManualWeld")
weld.Part0 = hitbox
weld.Part1 = humrp
weld.C0 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame)
weld.Parent = weld.Part0
hitbox.Touched:Connect(function(hit)
if hit:IsA("BasePart") then
if not hit:IsDescendantOf(character) then
if hit.Parent:FindFirstChildOfClass("Humanoid") then
local enemyHum = hit.Parent:FindFirstChildOfClass("Humanoid")
local enemyRP = enemyHum.RootPart
if enemyHum and enemyRP then
hitbox:Destroy()
if not enemyHum.Parent:FindFirstChild("Epitaph") then
if hit.Parent:FindFirstChild("DamageToDo") then
hit.Parent.DamageToDo.Value = hit.Parent.DamageToDo.Value + character.Stand.configs.HeavyPunchDamage.Value
else
if not character.Stand:FindFirstChild("Healing") then
local pushForce = Instance.new("BodyVelocity")
pushForce.Name = "PushForce"
pushForce.MaxForce = Vector3.new(10000000,10000000,10000000)
pushForce.Velocity = (-hit.Parent.HumanoidRootPart.CFrame.LookVector) * 50
pushForce.Parent = hit.Parent.HumanoidRootPart
spawn(function()
wait(.4)
pushForce:Destroy()
end)
enemyHum:TakeDamage(character.Stand.configs.HeavyPunchDamage.Value)
else
enemyHum.Health = enemyHum.Health + character.Stand.configs.HeavyPunchDamage.Value
end
end
if not plrsHit[enemyHum] then
DH.addTo(enemyHum,"Stunned")
plrsHit[enemyHum] = 40
enemyHum.WalkSpeed = 0
enemyHum.JumpPower = 0
local pushForce = Instance.new("BodyVelocity",enemyHum.Parent)
pushForce.Velocity = -enemyRP.CFrame.LookVector * 6
spawn(function()
wait(.5)
pushForce:Destroy()
end)
while wait(0.1) do
if plrsHit[enemyHum] > 0 then
plrsHit[enemyHum] -= 1
else
plrsHit[enemyHum] = nil
DH.removeFrom(enemyHum,"Stunned")
enemyHum.WalkSpeed = 16
enemyHum.JumpPower = 50
break
end
end
end
end
elseif plrsHit[enemyHum] then
plrsHit[enemyHum] = 30
enemyHum.WalkSpeed = 0
enemyHum.JumpPower = 0
end
end
end
end
end)
end
function module.HeavyPunch(player)
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:FindFirstChild("Humanoid")
local humanoidRP = character:FindFirstChild("HumanoidRootPart")
if not DH.findPlayer(humanoid,"Stunned") and not DH.findPlayer(humanoid,"Blocking") then
local Stand = character:FindFirstChild("Stand")
if Stand then
local Action
local AnimControl = Stand:FindFirstChild("AnimControl")
if AnimControl then
local controller = Stand.PrimaryPart:FindFirstChild("Controller")
if controller then
local goal = {}
goal.C0 = controller.Part0.CFrame:ToObjectSpace(controller.Part1.CFrame)
goal.C1 = controller.Part0.CFrame:ToObjectSpace(controller.Part1.CFrame + controller.Part1.CFrame.LookVector * 4.5)
local info = TweenInfo.new(.1)
local tween = TweenService:Create(controller,info,goal)
tween:Play()
local stunned1 = Instance.new("StringValue",character)
stunned1.Name = "Stunned"
Action = AnimControl:LoadAnimation(Stand.animations.HeavyPunch)
Action:Play()
local Folder = Instance.new("Folder",workspace)
Folder.Name = "Effects"
Debris:AddItem(Folder,.8)
wait(.6)
spawn(function()
local leftEffect = script.MeshPart:Clone()
leftEffect.CFrame = Stand.HumanoidRootPart.CFrame * CFrame.Angles(math.rad(90),0,0) + Stand.HumanoidRootPart.CFrame.LookVector * 3.5
leftEffect.Parent = workspace
Debris:AddItem(leftEffect,.3)
TweenService:Create(leftEffect,TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.Out),{Transparency = 0.5,Size = leftEffect.Size + Vector3.new(5,1,5)}):Play()
end)
if Stand.PrimaryPart:FindFirstChild("HeavyPunchCry") then
Stand.PrimaryPart.HeavyPunchCry:Play()
end
doDamage(character,Stand["HumanoidRootPart"],Folder)
if character:FindFirstChild("Stunned") then
character.Stunned:Destroy()
end
local goal = {}
goal.C0 = controller.Part0.CFrame:ToObjectSpace(controller.Part1.CFrame)
goal.C1 = controller.Part0.CFrame:ToObjectSpace(controller.Part1.CFrame * CFrame.new(-3,1,2))
local info = TweenInfo.new(.5)
local tween = TweenService:Create(controller,info,goal)
tween:Play()
remote:FireClient(player,true)
end
end
end
else
RemoteEvents.Punch:FireClient(player, false)
if character:FindFirstChild("Stunned") then
character.Stunned:Destroy()
end
end
end
return module
No no, the “RemoteEvents” is a folder. and I think the script think its an actual event, but the event is the HeavyPunch, I don’t even know what im saying, that’s how inexperienced and confused I am.