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 7 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.

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

Mouse.Button1Down:connect(function()
    Mouse.Move:connect(function()
        if Mouse.Target == "Center" then
          --code to move the objects model
        end
    end)
end)
0
No, it will not, what is "Center" supposed to be? plasma_node 343 — 7y
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 — 7y
0
you probably meant if mouse.Target.Name == "Center", which would make more sense. other than that it looks fine Perci1 4988 — 7y
0
also you don't need a move event unless you don't want to have to click each time Perci1 4988 — 7y

Answer this question