I want to preface this as I did in a previous post by saying that I’m using the code from “How to make a Boss Fight” video series made by NoobieYT (Code created by Luascripts) in the pursuit of studying and understanding it.
When the boss does its charge attack, it takes the player’s position, charges and stops at that exact position. What I want to do is to make it to where the boss goes past the player instead of stopping at the player’s position.
This is what I want to happen.
Here’s the module for the Charge:
module.Charge = function(Player, BossHumanoidRootPart, BossHumanoid)
local PlayerFound = table.find(AttackedPlayersArray, Player.Name)
if not PlayerFound then
table.insert(AttackedPlayersArray, PlayerIndexCount, Player.Name)
PlayerIndexCount += 1
end
local Beam = game:GetService("ServerStorage").Arrows:Clone()
Beam.Parent = workspace
local Attachment0 = game:GetService("ServerStorage").Attachment0:Clone()
Attachment0.Parent = workspace
local Attachment1 = game:GetService("ServerStorage").Attachment1:Clone()
local PlayerPosition = Player:FindFirstChild("HumanoidRootPart").Position
local PlayerCFrame = Player:FindFirstChild("HumanoidRootPart").CFrame
local LoadRollingAnimation = BossHumanoid:LoadAnimation(AnimationsFolder.Rolling)
Attachment1.Parent = workspace
Beam.Attachment0 = Attachment0.Attachment0
Beam.Attachment1 = Attachment1.Attachment1
Attachment0.Position = BossHumanoidRootPart.Position - Vector3.new(0, 6, 0) -- Attach Attachments to Player and Boss
Attachment1.Position = PlayerPosition - Vector3.new(0, 2, 0)
Beam.FaceCamera = true
Attachment0.Orientation = Vector3.new(0, 0, 90) + BossHumanoidRootPart.Position
Attachment1.Orientation = Vector3.new(0, 0, 90) + PlayerPosition
game.Debris:AddItem(Attachment0, 0.5)
game.Debris:AddItem(Attachment1, 0.5)
game.Debris:AddItem(Beam, 0.5)
task.wait(0.5)
TweenService:Create(BossHumanoidRootPart, TweenInfo.new((PlayerPosition + Vector3.new(0, 3, 0) - BossHumanoidRootPart.Position).Magnitude / 100), {CFrame = PlayerCFrame * CFrame.new(0, 3, 0)}):Play()
LoadRollingAnimation:Play()
local RollingSound = SoundsFolder.RocksRolling:Clone()
RollingSound.Parent = BossHumanoidRootPart
RollingSound:Play()
game.Debris:AddItem(RollingSound, RollingSound.TimeLength)
task.wait((PlayerPosition + Vector3.new(0, 3, 0) - BossHumanoidRootPart.Position).Magnitude / 100)
LoadRollingAnimation:Stop()
module.RockDebree(BossHumanoidRootPart.Position, 5)
end
I think I have to edit the TweenInfo to accomplish this, although I’m not sure. I did a little troubleshooting with it. Any push in the right direction to accomplish this?