Basically, I want it so when you press M, it spawns a wall, 10 studs in front of the player and in the direction that the player is facing. But it wont work!
function KeyDown(Key)
KeyHolding = true
if Key == "m" then
Wall()
if Key == "n" then
Nuke()
end
end
end
function Wall()
local Wall = Instance.new("Part",game.Workspace)
Wall.Position = CFrame.new(Torso.CFrame.x,0,Torso.CFrame.y)
Wall.CFrame = CFrame.new(Torso.CFrame.x, Torso.CFrame.y, Torso.CFrame.z + 10) * math.rad(0,0,Head.CFrame.lookVector) -- Note that the head and torso has already been specified through variables in another line (not featured)
wait(10)
Wall:Destroy()
end

2 comments
Did you bind the "KeyDown" function? And if possible, send the entire code.
it works but the wall part just spawns a normal part.