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

How do I make any model named "Moveable" be able to be dragged?

Asked by 8 years ago

Hello. So what I am trying to do is make any parts who's parent is a model, and the models name is Moveable to be able to be dragged with the mouse without a tool. Currently, the model just slowly comes towards the player, while still moving side to side if the mouse. It won't stop moving towards the player until it's basically on top of the player. My localscript:

repeat wait() until game.Players.LocalPlayer local p = game.Players.LocalPlayer local m = p:GetMouse() local down = false

m.Button1Down:connect(function(key) down = true repeat if m.Target ~= nil then if m.Target.Parent.Name == "Moveable" then m.Target.Parent:MoveTo(Vector3.new(m.Hit.p.X, m.Hit.p.Y, m.Hit.p.Z)) end end wait() until not down end)

m.Button1Up:connect(function(key) if down then down = false end end)

Answer this question