I’m trying to create a Region3 in front of the right arm that stays relative to the HRP.
However, when I turn it doesn’t work as expected. It gets all funky and doesn’t remain straight.
I came here hoping to find a solution. Any help will gladly be appreciated.
What I’m trying to achieve:
What is happening:
LocalScript:
local Character = game.Players.LocalPlayer.Character
local RootPart = Character:WaitForChild("HumanoidRootPart")
local VisualPart = Instance.new("Part",workspace.Hitbox)
VisualPart.BrickColor = BrickColor.new("Really red")
VisualPart.Material = "Neon"
VisualPart.CanCollide = false
VisualPart.Transparency = 0.85
game:GetService("RunService").RenderStepped:connect(function()
local p1 = RootPart.CFrame * CFrame.new(1,-3,0)
local p2 = RootPart.CFrame * CFrame.new(1.8,3,-5.5)
local Point1 = p1.p
local Point2 = p2.p
local region3 = Region3.new(
Vector3.new(
math.min(Point1.X, Point2.X),
math.min(Point1.Y, Point2.Y),
math.min(Point1.Z, Point2.Z)
),
Vector3.new(
math.max(Point1.X, Point2.X),
math.max(Point1.Y, Point2.Y),
math.max(Point1.Z, Point2.Z)
)
)
VisualPart.Size = region3.Size
VisualPart.CFrame = region3.CFrame
end)