I am making a uni beam and I want the beam in front of the player no matter what way they are facing. I have tried just increasing the X position but that changes based on what way they are facing.
What Happens:
What I want to happen:
Code:
local Player = game:GetService("Players").LocalPlayer
local Controls = require(Player.PlayerScripts:WaitForChild("PlayerModule")):GetControls()
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if input.KeyCode == Enum.KeyCode.E then
print("Pressed E!")
local UniBeam = ReplicatedStorage.Magic.UniBeam.Main:Clone()
UniBeam.Parent = Player.Character
UniBeam.CFrame = Player.Character.HumanoidRootPart.CFrame
UniBeam.Orientation = Vector3.new(UniBeam.Orientation.X, (UniBeam.Orientation.Y + 90), UniBeam.Orientation.Z)
--UniBeam.Position = Vector3.new((UniBeam.Position.X + (UniBeam.Size.X / 2)), UniBeam.Position.Y, UniBeam.Position.Z)
--Controls:Disable()
end
end)