Hello Scripters!
I’ve created an enemy that jumps into the sky and lands at the players original spot before exploding, killing itself but creating a huge AoE that deals massive damage.
The only issue is that after dying, it suddenly teleports back to the players original position (The entity teleports above the player for around 3 seconds to make sure that it will land where the player originally was, if that even makes sense.)
Function of the attack
local function Explode(PlrCharacter)
local JumpingAnim = Instance.new("Animation")
JumpingAnim.AnimationId = "rbxassetid://14651560449"
local JumpingTrack = Humanoid:WaitForChild("Animator"):LoadAnimation(JumpingAnim)
JumpingTrack:Play()
JumpingTrack:GetMarkerReachedSignal("EnemyJump"):Connect(function()
Character.HumanoidRootPart.Anchored = true
local FunnyJumpSound = Instance.new("Sound")
game:GetService("Debris"):AddItem(FunnyJumpSound,0.612)
FunnyJumpSound.SoundId = "rbxassetid://7218305705"
FunnyJumpSound.RollOffMaxDistance = 10000
FunnyJumpSound.RollOffMinDistance = 10
FunnyJumpSound.Volume = 1
FunnyJumpSound.Parent = Character.HumanoidRootPart
FunnyJumpSound:Play()
local TweenGoal = {
Position = Character.HumanoidRootPart.Position + Vector3.new(0, 50, 0)
}
local Tweeninfo = TweenInfo.new(
0.5,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
local Tween = game:GetService("TweenService"):Create(Character.HumanoidRootPart,Tweeninfo,TweenGoal)
Tween:Play()
task.wait(3)
Character.HumanoidRootPart.Position = PlrCharacter.PrimaryPart.Position + Vector3.new(0, 50, 0)
local TweenGoal = {
Position = Character.HumanoidRootPart.Position + Vector3.new(0, -50, 0)
}
local Tweeninfo = TweenInfo.new(
0.1,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
local Tween = game:GetService("TweenService"):Create(Character.HumanoidRootPart,Tweeninfo,TweenGoal)
Tween:Play()
Tween.Completed:Connect(function()
Character.HumanoidRootPart.Anchored = false
task.wait(0.3)
Humanoid.Health = 0
end)
end)
end
Ragdoll Effect
local Connection
Connection = Humanoid.Died:Connect(function()
Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp,false)
for index, Joints in pairs(Character:GetDescendants()) do
if Joints:IsA("Motor6D") then
local BallSocket = Instance.new("BallSocketConstraint",Joints.Parent)
local A1 = Instance.new("Attachment",Joints.Part0)
local A2 = Instance.new("Attachment",Joints.Part1)
BallSocket.Attachment0 = A1
BallSocket.Attachment1 = A2
A1.CFrame = Joints.C0
A2.CFrame = Joints.C1
BallSocket.LimitsEnabled = true
BallSocket.TwistLimitsEnabled = true
Joints:Destroy()
end
end
Connection:Disconnect()
Character.Bomb:Destroy()
local DeathSound = Instance.new("Sound")
game:GetService("Debris"):AddItem(DeathSound,6)
DeathSound.SoundId = "rbxassetid://12222084"
DeathSound.RollOffMaxDistance = 10000
DeathSound.RollOffMinDistance = 10
DeathSound.Volume = 1
DeathSound.Parent = Character.HumanoidRootPart
DeathSound:Play()
--[[
local Explosion = Instance.new("Explosion")
game:GetService("Debris"):AddItem(Explosion,3)
Explosion.Parent = workspace.Debris
Explosion.Position = Character.HumanoidRootPart.Position
Explosion.DestroyJointRadiusPercent = 0
]]
game:GetService("Debris"):AddItem(Character,3)
end)