Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I snap/move a part to a selected objects face?

Asked by 5 years ago

Hello there, im curious as to how I would relocate an object/part in workspace to a selected face

I tried using Mouse.TargetSurface but it was a shot in the dark as its type is a NormalID I will include the code I have so far... all the code I have right now is to select the objects surface face

Mouse = game.Players.LocalPlayer:GetMouse()

function click()
    if script.Parent.Parent.Value.Value == false then

    Mouse.Move:Connect(move)

    script.Parent.Parent.Value.Value = true 
    script.Parent.Parent.Parent.BF.Visible = true
    script.Parent.BackgroundColor3 = Color3.new(BrickColor.Red)
    else
        script.Parent.Parent.Value.Value = false
        script.Parent.Parent.Parent.BF.Visible = false
        script.Parent.BackgroundColor3 = Color3.new(BrickColor.White)

    end
end

function move()
if script.Parent.Parent.Value.Value == true then
print(Mouse.TargetSurface)



end


end


function mouseClick()
    if script.Parent.Parent.Value.Value == true then
    local Target = Mouse.Target
    local a = Instance.new("Part")

    a.Parent = game.Workspace
    a.Size = Vector3.new(4,4,4)
    a.Position = Mouse.TargetSurface
    print(Target.Position)
    script.Parent.Parent.SurfaceSelection.Adornee = Target
    script.Parent.Parent.SurfaceSelection.TargetSurface = Mouse.TargetSurface
    end

end

Mouse.Button1Down:Connect(mouseClick)
script.Parent.MouseButton1Click:Connect(click)

0
That's not how Color3's work. You can't assign a Color3 value to a function. You'll have to do it like: "script.Parent.BackgroundColor3 = BrickColor.Red().Color" User#19524 175 — 5y
0
Quite aware thanks. Chaserox 62 — 5y
0
But thats not what the question is asking :) Chaserox 62 — 5y

Answer this question