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

Will this "Move with mouse" script work?

Asked by 8 years ago

I want this to move an object named "Center" when it is clicked by the mouse. Will it work? I ask because I do not have access to the studio as of right now.

01local Player = game.Players.LocalPlayer
02local Mouse = Player:GetMouse()
03 
04Mouse.Button1Down:connect(function()
05    Mouse.Move:connect(function()
06        if Mouse.Target == "Center" then
07          --code to move the objects model
08        end
09    end)
10end)
0
No, it will not, what is "Center" supposed to be? plasma_node 343 — 8y
0
Go ahead and read the answer for this question, it should help. https://scriptinghelpers.org/questions/2721/whats-the-difference-between-mousehit-mousetarget plasma_node 343 — 8y
0
you probably meant if mouse.Target.Name == "Center", which would make more sense. other than that it looks fine Perci1 4988 — 8y
0
also you don't need a move event unless you don't want to have to click each time Perci1 4988 — 8y

Answer this question