So in my jojo game, I have a donut move, that when the hitboxHow would I go about making the player that the hitbox hit’s humanoidRootPart, to be on the stands Left Arm for the entirety of the animation. I’m wondering how I could do this. If someone could help me out, it would be greatly appreciated.
Here’s the script that I have at the moment (It’s a serverscript.):
local rp = game:GetService("ReplicatedStorage")
local HeavyPunch = rp:WaitForChild("Stand1Remotes"):WaitForChild("ShineiKakyoins")
local Debris = game:GetService("Debris")
local TweenService = game:GetService("TweenService")
local damage = 75
HeavyPunch.OnServerEvent:Connect(function(Player)
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local HumanoidRP = Character:WaitForChild("HumanoidRootPart")
local Stand = workspace:FindFirstChild(Player.Name.." Stand"):FindFirstChild("Dummy")
local Folder = Instance.new("Folder",workspace)
Folder.Name = Player.Name.." Heavy Punch"
Debris:AddItem(Folder,.5)
if Stand then
local prevWeld = Stand:WaitForChild("HumanoidRootPart"):WaitForChild("Stand Weld")
prevWeld:Destroy()
Stand:WaitForChild("HumanoidRootPart").CFrame = HumanoidRP.CFrame * CFrame.new(0,-.5,-2)
local weld = Instance.new("ManualWeld")
weld.Name = "Stand Weld"
weld.Part0 = Stand:WaitForChild("HumanoidRootPart")
weld.Part1 = HumanoidRP
weld.C0 = Stand:WaitForChild("HumanoidRootPart").CFrame:inverse() * HumanoidRP.CFrame
weld.Parent = weld.Part0
local AnimControl = Stand:WaitForChild("AnimControl")
for i, track in pairs(AnimControl:GetPlayingAnimationTracks()) do
track:Stop()
end
local Punch = AnimControl:LoadAnimation(script:WaitForChild("Punch"))
Punch:Play()
local Hitbox = script:WaitForChild("Hitbox"):Clone()
Hitbox.Parent = Folder
Hitbox.CFrame = Stand:WaitForChild("Left Arm").CFrame
local hweld = Instance.new("ManualWeld")
hweld.Part0 = Hitbox
hweld.Part1 = Stand:WaitForChild("Right Arm")
hweld.C0 = hweld.Part0.CFrame:inverse() * hweld.Part1.CFrame
hweld.Parent = hweld.Part0
Hitbox.Touched:Connect(function(Hit)
if Hit:IsA("Part") or Hit:IsA("MeshPart") then
if Hit.Parent ~= Character then
local EHumanoid = Hit.Parent:FindFirstChild("Humanoid")
local EHumRP = Hit.Parent:FindFirstChild("HumanoidRootPart")
if EHumanoid and EHumRP then
Hitbox:Destroy()
local d = EHumanoid:LoadAnimation(script.Donutada)
d:Play()
while not d.Stopped do
EHumRP.CFrame = Stand:WaitForChild("Left Arm").CFrame
end
EHumanoid:TakeDamage(damage)
if EHumanoid.Health < 1 then
Player.leaderstats.Kills.Value = Player.leaderstats.Kills.Value + 1
Player.leaderstats.moneys.Value = Player.leaderstats.moneys.Value + 50
end
local Sound = Instance.new("Sound",Stand)
Sound.Volume = .75
Sound.SoundId = "rbxassetid://1089136667"
Sound:Play()
Debris:AddItem(Sound,.5)
local vel = Instance.new("BodyVelocity",EHumRP)
vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
vel.Velocity = HumanoidRP.CFrame.lookVector * 150
Debris:AddItem(vel, .5)
end
end
end
end)
wait(2.5)
local prevWeld = Stand:WaitForChild("HumanoidRootPart"):WaitForChild("Stand Weld")
prevWeld:Destroy()
Stand:WaitForChild("HumanoidRootPart").CFrame = HumanoidRP.CFrame * CFrame.new(2,0,2)
local weld = Instance.new("ManualWeld")
weld.Name = "Stand Weld"
weld.Part0 = Stand:WaitForChild("HumanoidRootPart")
weld.Part1 = HumanoidRP
weld.C0 = Stand:WaitForChild("HumanoidRootPart").CFrame:inverse() * HumanoidRP.CFrame
weld.Parent = weld.Part0
local Idle = AnimControl:LoadAnimation(script:WaitForChild("Idle"))
Idle:Play()
HeavyPunch:FireClient(Player)
end
end)