Scaling attack based on the Y position?

I want to have this ice basically follow me based on where I am based on the Y axis. I’m not sure how I’d go about doing this, as I have an instant transmission attack essentially, one CFrame to another.

I’m completely unsure of what I should do about this. I’ve made a ray casting function that basically looks in front of the character, and then finds the highest point of the brick, then teleports the player to it. But I’m not too sure on how I would migrate the attack I’ve created, which essentially travels in a straight line to forge into something that I want.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local Ray_Parameters = RaycastParams.new();
Ray_Parameters.FilterType = Enum.RaycastFilterType.Blacklist;
Ray_Parameters.FilterDescendantsInstances = {Character};
Ray_Parameters.IgnoreWater = true;


local Raycast = workspace:Raycast(Character.PrimaryPart.Position, Vector3.new(0,0,-50), Ray_Parameters);

if (Raycast) then
    print(Raycast.Instance.Name);
    local Clipped_Part = Raycast.Instance;

    local Cframe, Size = Character:GetBoundingBox();
    print(Cframe, Size);

    local tempCF = Cframe * CFrame.new(0, (Size.Y / 2), 0)
    local topY = tempCF.Y

    local Orientation = HumanoidRootPart.Orientation;
    HumanoidRootPart.CFrame = CFrame.new(HumanoidRootPart.Position + Vector3.new(0,topY/2,0));
    HumanoidRootPart.Orientation = Orientation;
end


local HRP_CFrame = CFrame.new(HumanoidRootPart.Position.X, 0, HumanoidRootPart.Position.Z);
local Offset = CFrame.new(0,0,60);
for x = 1,5 do wait();
    local Random_Interval = math.random(10,200)*-1;
    --print(Random_Interval);

    Offset = Offset * CFrame.new(0,-1.5,-10);
    local Ice_Spike = Parts.Ice_Spike:Clone();
    Ice_Spike.Parent = workspace;
    Ice_Spike.CFrame = HRP_CFrame * Offset;
    local Ice_Spike_CFrame = Ice_Spike.CFrame;

    local Semi_Shockwave = Parts.Semi_Shockwave:Clone();
    Semi_Shockwave.Parent = workspace;
    Semi_Shockwave.CFrame = Ice_Spike.CFrame * CFrame.new(0,5,0);

    local Raise_Sound = Ability_Sounds.Ice_Raise:Clone();
    Raise_Sound.Parent = Ice_Spike;
    Raise_Sound.Volume = 5;
    Raise_Sound:Play();

    local Goal = {
        Size = Vector3.new(15.99, 24.965, 15.315);
        CFrame = Ice_Spike_CFrame;
    };

    local Shockwave_Goal = {
        Transparency = 1;
        Size = Vector3.new(50,2,50);
        Orientation = Vector3.new(0, math.random(-360,360), 0);
    };

    local Tween = TweenService:Create(Ice_Spike, TweeningInfo, Goal);
    Tween:Play();

    local Shockwave_Tween = TweenService:Create(Semi_Shockwave, TweeningInfo_Fade, Shockwave_Goal);
    Shockwave_Tween:Play();
end

I’m completely lost and confounded. If anyone could help, that’d be great! :smile:

When you define HRP_CFrame you are setting the Y to a value of 0 meaning it will not be at the same height as the HumanoidRootPart. If you want it to be the same height you should set it to the HumanoidRootPart’s height similar to how you did the X and Z values.

I tried that, it got a bit confusing…

wait, this is a draft of code that didnt work, hold on.

I figured it out, I just ray cast each ice attack, and checked to see if something was above it. :+1:

Even better of a fix:

I figured out where the part intersected with the floor, and then positioned it to that position specifically, I know this thread is old, but for anyone wondering or wanting to do something similar to this, here you go.