I have this script that makes these huge rock cubes that send the dummy into the air and holds it there for a few seconds which damages it, but after the rocks despawn the dummy is supposed to fall back to the ground. It's not doing that, it's stuck in the air even after the rocks disapear. If someone could help me with this that'd be appreciated.
Gyazo GIF of what the script looks like : https://gyazo.com/5464c7a70de70c9a04c05d3accfd119d
Script:
local tweenService = game:GetService("TweenService")
script.Parent.OnServerEvent:Connect(function(player)
local character = player.Character
for i,m in pairs(workspace:GetChildren()) do
if m:FindFirstChild("HumanoidRootPart") and m:FindFirstChild("Humanoid") and m~= player.Character then
if (m.HumanoidRootPart.Position - character.HumanoidRootPart.Position).Magnitude < 45 then
local enemychar = m
local EnemyRoot = m.HumanoidRootPart
local tweeninfo = TweenInfo.new(0.5,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0,false,0)
local tweeninfo2 = TweenInfo.new(0.5,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0,false,0)
local tweeninfo3 = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0,false,0)
EnemyRoot.Anchored = true
local goal = {}
goal.CFrame = EnemyRoot.CFrame * CFrame.new(0,80,0)
local tween = tweenService:Create(EnemyRoot,tweeninfo,goal)
tween:Play()
print("played")
for i = 1 ,10 do
wait(0.3)
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://4580495407"
sound.Parent = character.HumanoidRootPart
sound:Play()
game.Debris:AddItem(sound,1)
print("made a part")
local ball = Instance.new("Part")
ball.Shape = Enum.PartType.Block
ball.Anchored = true
ball.Material = Enum.Material.Cobblestone
ball.BrickColor = BrickColor.new("Earth orange")
ball.Position = enemychar.HumanoidRootPart.Position + Vector3.new(math.random(-10,10),-80,math.random(-10,10))
ball.Size = Vector3.new(math.random(20,65), math.random(20,60), math.random(40,40))
ball.CanCollide = false
ball.Parent = workspace
game.Debris:AddItem(ball,5)
local goal2 = {}
goal2.CFrame = EnemyRoot.CFrame * CFrame.new(math.random(1,10),math.random(1,10),math.random(1,10))
local tween2 = tweenService:Create(ball,tweeninfo2,goal2)
tween2:Play()
print("played the tween")
end
wait(2)
local explosion = Instance.new("Sound")
explosion.SoundId = "rbxassetid://2770705979"
explosion.Parent = character.HumanoidRootPart
explosion:Play()
game.Debris:AddItem(explosion,1)
local whirl = game.ReplicatedStorage.Chibaku:WaitForChild("Whirl"):Clone()
whirl.CFrame = EnemyRoot.CFrame
whirl.Parent = workspace
game.Debris:AddItem(whirl,3)
local goal5 = {}
goal5.Size = whirl.Size * 2
goal5.Transparency = 1
local tween5 = tweenService:Create(whirl,tweeninfo3,goal5)
tween5:Play()
for i = 1,15 do
local Part = Instance.new("Part")
local fire = Instance.new("Fire",Part)
Part.Parent = workspace
Part.Anchored = false
Part.Name = "loop"
Part.CanCollide = true
Part.Shape = Enum.PartType.Block
Part.Size = Vector3.new(5,5,5)
Part.BrickColor = BrickColor.new("Terra Cotta")
Part.Material = Enum.Material.Neon
Part.CFrame = EnemyRoot.CFrame * CFrame.new(0,30,0)
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.Parent = Part
BodyVelocity.Velocity = Vector3.new(math.random(-100,100),math.random(-100,100),math.random(-100,100))
BodyVelocity.MaxForce = Vector3.new(1e8,1e8,1e8)
game.Debris:AddItem(BodyVelocity,1)
game.Debris:AddItem(Part,6)
end
EnemyRoot.Anchored = false
enemychar.Humanoid:TakeDamage(10)
end
end
end
end)
