Hello fellow Roblox Developers!
–Introduction–
I’m making a tool that makes it so that when you press e, a rock wall spawns next to the player and pushes nearby enemies into the void.
–Problem–
To spawn the wall next to the player, I used player.Character.HumanoidRootPart.Position + player.Character.HumanoidRootPart.CFrame.LookVector, but the wall spawns at the wrong direction the player is facing.
Distance = 4; --Studs away
Wall.CFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-Distance) --Negative distance to make it go forward
Try playing around with the angles if that doesn’t work
Also, assuming that your using a loop to move the brick, it’s still going the wrong way
Distance = 4; --Studs away
Wall.CFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-Distance) * CFrame.Angles(math.rad(90),0,0) --Negative distance to make it go forward
rate = 2
for i=1,100 do
Wall.CFrame = Wall.CFrame * CFrame.new(0,0,-rate)
wait(.01) --Every 0.1 seconds it will move rate studs
end