Generate a wall in front of a player

Does anyone know how to generate a wall in front of the player, when I do it always looks in one position, how could I make it detect its orientation or something like that?

1 Like

I don’t know a exactly script but something like you create a model to the wall and put on the replicated storage and when the player press a key, you can use look vector to the position I Guess

βœ“ Possible Solution


Using CFrame you can set a position and orientation at the same time.


function SpawnWall(plr) -- Call function with the player
	local HRP = plr.Character.HumanoidRootPart -- Gets the HumanoidRootPart
	local Wall = Wall:Clone() -- Wall Location
	
	local offset = Vector3.new(0,0,-3) -- Offset from player
	Wall.CFrame = HRP.CFrame*CFrame.new(offset)  -- Sets CFrame
end
2 Likes

brick infront of player.rbxl (29.8 KB)

1 Like