Hi, I’m trying to make a placement system for 2x2x2 parts,
unfortunately, I don’t know how to make it so it sticks to the Mouse.Target orientation like in the image below:
I tried searching a lot of these on YouTube and found nothing except one that was exactly what I was looking for, until it had no script or tutorial with it
Anyways I don’t want a full script but just the methods on how to do that, thank you
Look into using WorldRoot:Raycast() and the returned RayCastResult.Normal Property
Example coming within 5-10 minutes
local Mouse = game.Players.LocalPlayer:GetMouse()
local Template = Instance.new("Part") -- only inside player so the ray/mouse ignores it
Template.Anchored = true
Template.Size = Vector3.new(1,1,1)
Template.Color = Color3.fromRGB(32, 255, 29)
Template.Transparency = 0.5
Template.Name = "Template"
Template.Parent = game.Players.LocalPlayer.Character
while wait(.2) do
local Params = RaycastParams.new()
Params.FilterType = Enum.RaycastFilterType.Blacklist
Params.FilterDescendantsInstances = {game.Players.LocalPlayer.Character}
local Result = workspace:Raycast(game.Workspace.CurrentCamera.CFrame.Position,(Mouse.Hit.Position-game.Workspace.CurrentCamera.CFrame.Position).Unit*50,Params)
if Result ~= nil then
Template.CFrame = CFrame.new(Result.Position, Result.Normal)
end
end
Heres the example, sort of works as intended, but doesnt orientate correctly, but look into RaycastResult.Normal, very useful feature.