I’m doing a boss fight in my game and have a boss attack where the boss comes from under the ground( like spikes) I also have a target( the thing that indicates where the boss is gonna show up)
That’s the script : wait(5)
local function enemyChallenge()
local bool = true
local No = 0
while task.wait(0.9) do
if bool == true and No <=9 then
for i,player in pairs(game.Players:GetPlayers()) do
if player.Character then
local enemy = game.ReplicatedStorage.Enemy:Clone()
local target = game.ReplicatedStorage.Target:Clone()
local dirt = game.ReplicatedStorage.Dirt:Clone()
target.Parent = game.Workspace
target.CFrame = (player.Character.HumanoidRootPart.CFrame - Vector3.new(0, 2.7, 0)) * CFrame.Angles(0, 0,math.rad(90))
dirt.Parent = game.Workspace
dirt.CFrame = (player.Character.HumanoidRootPart.CFrame - Vector3.new(0, 2.8, 0))
wait(0.7)
enemy.Parent = game.Workspace
enemy:MoveTo(target.Position - Vector3.new(0, 3, 0))
wait(0.9)
target:Destroy()
enemy:Destroy()
dirt:Destroy()
end
end
No += 1
end
end
end
enemyChallenge()
the problem is that the script checks the players hrp to spawn the target under the player ( I use Vector3 to move target under so that it will appear on the ground. But when you jump, the players hrp moves up. So in this situation the target appears above the ground. I’d to always appear on the ground, even if they jump.
I dont even know where I start to fix this problem. The only thing I could think of is attaching, rigging or welding the target, which obviously didnt work…
the brown thing is the target, as you can see it looks weird