Hi, I will try to explain this as good as I can but, I found a formula to find the direction of what the players humanoid root part is looking at, so I used that formula then I tried to change it by changing the position to be 10 studs farther. I tried many things and couldn’t find a single solution, my brain is not good with CFrame.
This script spawns rocks at the root parts position
function StraightRocks(root,player)
local parms = RaycastParams.new()
parms.FilterDescendantsInstances = {workspace.Ability.Debris,characters}
parms.FilterType = Enum.RaycastFilterType.Blacklist
local angle = 0
-- Creating Rocks
for i = 1,5 do
local size = math.random(4,7)
local height = math.random(8,15)
local part = Instance.new("Part")
local sound = Instance.new("Sound")
sound.Parent = part
sound.SoundId = "rbxassetid://9125869138"
sound.RollOffMaxDistance = 200
sound.RollOffMinDistance = 6
sound.Volume = 1.2
local direction = player.Character.HumanoidRootPart.Position + player.Character.HumanoidRootPart.CFrame.LookVector * player.Character.HumanoidRootPart.Position.Magnitude
-- Properties
part.Anchored = true
part.Size = Vector3.new(1,1,1)
part.CFrame = CFrame.lookAt(player.Character.HumanoidRootPart.Position, direction)
game.Debris:AddItem(part,5)
local raycast = workspace:Raycast(part.CFrame.p,part.CFrame.UpVector * -10, parms)
if raycast then
part.Position = raycast.Position + Vector3.new(0,-5,0)
part.CanCollide = false
part.Material = Enum.Material.Rock
part.Color = raycast.Instance.Color
part.Size = Vector3.new(8,height,8)
part.Orientation = Vector3.new(part.Orientation.X,math.random(-180,180),part.Orientation.Z)
part.Parent = workspace.Ability.Debris
sound:Play()
local Tween = game:GetService("TweenService"):Create(part,TweenInfo.new(.25,Enum.EasingStyle.Bounce,Enum.EasingDirection.Out),{Position = part.Position + Vector3.new(0,5,0)}):Play()
delay(4,function()
local Tween = game:GetService("TweenService"):Create(part,TweenInfo.new(1),{Transparency = 1}):Play()
end)
end
angle += 100
wait(0.2)
end
end