So I need to make a part follow the mouse for my games. Is there a simple way to move a part depending on the position of the mouse? I have tried using the events and functions that the mouse object has but have failed each time. I am using a local script that is in StarterGui and the part is in workspace. Anyway here is the code I am trying to use.
I could easily be doing this completely wrong but here's my attempt:
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() Mouse.Move:connect(function() -- When the mouse moves it triggers the function game.Workspace.Part.Position = Vector3.new(Mouse.Target) -- This is my error end)
On line 5 I also tried using Mouse.Hit, Mouse.TargetFilter, Mouse.X and Y, And the rest of the properties that had to do with the position of the mouse. I could have missed one so here is the link to the page I am looking at:
Thanks for the help!