So basically I am making a Naruto Game and i decided to make a Mud Wall Jutsu. This script works fine except when i press E to build the wall while walking the wall is tilted forward since my avatars body is tilted forward while moving. I wanted to know if there is a way to fix this?
local repStorage = game:GetService('ReplicatedStorage')
local WallBuild = repStorage:WaitForChild('RemoteEvents').ClientToServerWallBuild
WallBuild.OnServerEvent:Connect(function(player)
local chr = player.Character
local torso = chr.UpperTorso
print(player.Name..' Fired A Jutsu!')
local MudWall = Instance.new('Part')
MudWall.Color = Color3.fromRGB(106, 87, 52)
MudWall.Material = Enum.Material.Slate
MudWall.Anchored = true
MudWall.CanCollide = true
MudWall.Size = Vector3.new(42, 21, 2)
MudWall.Position = torso.Position + torso.CFrame.lookVector * 5
MudWall.Rotation = torso.Rotation
MudWall.Parent = game.Workspace
print('end')
end)

2 comments
Thank you! Also do you know how i would make the part not halfway underground? (If you could do another answer that would rock cause then i actually get the notification
Sorry but that would be rather complicated, especially if your terrain is not flat (or you are planning it to be not flat). I think your best bet would be raycasting to measure a distance to the ground.