Still have questions? Join our Discord server and get real time help.
Log in to vote

Make an object move when clicked & dragged with CFrame?

Asked by
Sinieh -5
3 months ago
Edited 3 months ago

I have a script that makes a "wall decor" moved on only the x and y cords but the "wall decor" teleports on the roof when it collides with another part but not when it collides with another "wall decor." I think I might need to make it a CFrame. I can't figure out how though, I've tried many ways.

Add onto/fix this script: (make sure its a local script in starter pack.)

local player = game.Players.LocalPlayer local mouse = player:GetMouse() local mtarget local down

function clickObj() if mouse.Target ~= nil and mouse.Target.Name ~= "Baseplate" and mouse.Target.Name ~= "Part" then mtarget = mouse.Target print(mtarget) mouse.TargetFilter = mtarget print (mouse.TargetFilter) down = true end end mouse.Button1Down:connect(clickObj)

function mouseMove() if down and mtarget then local posX,posY,posZ = mouse.Hit.X,mouse.Hit.Y,mouse.Hit.Z

        mtarget.Position =,posY,0)
end mouse.Move:connect(mouseMove)

function mouseDown() down = false mtarget = nil mouse.TargetFilter = nil end mouse.Button1Up:connect(mouseDown)

Much appreciated it, Thanks!

Try using CFrame to move Leamir 1205 — 3mo
^ I was trying to avoid CFrame because I'm not at all good at it. Sinieh -5 — 3mo
you can just use the position components of the cframe ex: theking48989987 1337 — 3mo
Script doesn't work when I try that. Sinieh -5 — 3mo

Answer this question