Hello developers. I am having trouble with my Boss script. The model is sliding in the air and rotating, even when the CFrame is not set. I am not that experienced so pardon my messy code.
for i, track in ipairs(npc.Humanoid.Animator:GetPlayingAnimationTracks()) do
track:Stop()
end
local jumpTrack = npc.Humanoid.Animator:LoadAnimation(npc.Animations.Jump)
local idelTrack2 = npc.Humanoid.Animator:LoadAnimation(npc.Animations.Atk2Idle)
npc.HumanoidRootPart.Anchored = true
local oldPos = npc.HumanoidRootPart.Position
local tweenToJump = TweenService:Create(npc.HumanoidRootPart,TweenInfo.new(jumpTrack.Length+0.1),{Position = npc.HumanoidRootPart.Position+Vector3.new(0,10,0)})
local tableOfPlrs = {}
for i=1,5 do
local randomPlr
repeat
randomPlr = Players:GetChildren()[math.random(1,#Players:GetChildren())] task.wait()
until not table.find(tableOfPlrs,randomPlr) or #tableOfPlrs>=#Players:GetChildren()
if #tableOfPlrs>=#Players:GetChildren() then
break
end
table.insert(tableOfPlrs,randomPlr)
end
jumpTrack:Play()
local yuhay
jumpTrack.KeyframeReached:Connect(function(kName)
if kName == "Jump" then
print("h")
tweenToJump:Play()
jumpTrack:Stop()
idelTrack2:Play()
local ball = Instance.new("Part")
ball.Transparency = .2
ball.Anchored = true
ball.Shape = Enum.PartType.Ball
ball.Material = Enum.Material.Neon
ball.Color = Color3.new(1, 0.643137, 0.0313725)
ball.CanCollide = false
ball.Size = Vector3.new(0,0,0)
ball.Parent = workspace.Projectiles
ball.Position = oldPos+Vector3.new(0,10,0)
TweenService:Create(ball,TweenInfo.new(.2),{Size = Vector3.new(12,12,12)}):Play()
idelTrack2:Play()
task.wait(.5)
TweenService:Create(ball,TweenInfo.new(.2),{Size = Vector3.new(0.1,0.1,0.1)}):Play()
task.wait(.2)
ball:Destroy()
for i, plr in ipairs(tableOfPlrs) do
local char = plr.Character or plr.CharacterAdded:Wait()
local position = char.PrimaryPart.Position
npc.PrimaryPart.Position = char.PrimaryPart.Position+Vector3.new(0,10,0)
TweenService:Create(npc.PrimaryPart,TweenInfo.new(.2),{Position = position}):Play()
task.wait(.2)
char.Humanoid:TakeDamage(50)
script.Parent.hit_punch_s:Play()
TweenService:Create(npc.HumanoidRootPart,TweenInfo.new(jumpTrack.Length+0.1),{Position = char.PrimaryPart.Position+Vector3.new(0,10,0)}):Play()
task.wait(.2)
local ball = Instance.new("Part")
ball.Transparency = .2
ball.Anchored = true
ball.Shape = Enum.PartType.Ball
ball.Material = Enum.Material.Neon
ball.Color = Color3.new(1, 0.643137, 0.0313725)
ball.CanCollide = false
ball.Size = Vector3.new(0,0,0)
ball.Parent = workspace.Projectiles
ball.Position = char.PrimaryPart.Position+Vector3.new(0,10,0)
TweenService:Create(ball,TweenInfo.new(.2),{Size = Vector3.new(12,12,12)}):Play()
idelTrack2:Play()
task.wait(.5)
TweenService:Create(ball,TweenInfo.new(.2),{Size = Vector3.new(0.1,0.1,0.1)}):Play()
task.wait(.2)
ball:Destroy()
if i == #tableOfPlrs then
yuhay = position+Vector3.new(0,10,0)
npc.HumanoidRootPart.Anchored = false
npc.PrimaryPart.Position = position+Vector3.new(0,10,0)
end
end
for i, track:AnimationTrack in ipairs(npc.Humanoid.Animator:GetPlayingAnimationTracks()) do
track:Stop()
end
npc.HumanoidRootPart.Anchored = false
npc.PrimaryPart.Position = yuhay+Vector3.new(0,10,0)
end
end)