For simplicity lets say i am creating a new WedgePart in front of the player. How do i rotate the new part so that it is facing the same direction as the player?
I tried .Orientation as per the code below, however this rotates relative to the map xyz. The best i can figure on my own is that i need to use the lookvector of the player, however never using one yet i have failed to get anywhere.
Thanks in advance.
local part = Instance.new('WedgePart', game.Workspace) part.Name = 'Slope' part.CFrame = player.Character.PrimaryPart.CFrame * CFrame.new(0,0,-5) part.Size = Vector3.new(10,15,15) part.Orientation = Vector3.new(0,180,0) part.BrickColor = BrickColor.Random() part.CanCollide = true part.Anchored = true part.Material = 'Plastic'
Simply needed to add cframe.angles argument, and remove orientation. fixed code is below for anyone who needs it. Just change the angles on the end of line 3 to rotate.
local part = Instance.new('WedgePart', game.Workspace) part.Name = 'Slope' part.CFrame = player.Character.PrimaryPart.CFrame * CFrame.new(0,0,-5) * CFrame.Angles(0,math.rad(180),0) part.Size = Vector3.new(10,15,15) part.BrickColor = BrickColor.Random() part.CanCollide = true part.Anchored = true part.Material = 'Plastic'