You weren't very specific and this isn't a request site, use a local script in player gui, get the player's mouse, set the cframe of the part to constantly update using a loop to the .Target of the player's mouse (mouse.Hit). Not very descriptive question = not very descriptive answer.
Fine, because I'm feeling nice, I'll tell you! Here's the code that should go in a local script in StarterGui, but this is only basic and will be a bit glitchy.
01 | plr = game.Players.LocalPlayer |
03 | repeat wait() until plr.Character |
04 | p = Instance.new( "Part" ,game.Workspace) |
06 | repeat wait() until mouse.Hit ~ = nil and mouse.Target ~ = nil and mouse.Target ~ = p |
07 | p.CFrame = mouse.Hit*CFrame.fromEulerAnglesXYZ(math.rad( 0 ),math.rad( 0 ),math.rad( 0 )) |
08 | p.CFrame = p.CFrame+Vector 3. new( 0 , 0.5 , 0 ) |
11 | if mouse.Hit ~ = nil and mouse.Target ~ = nil and mouse.Target ~ = p then |
12 | p.CFrame = mouse.Hit*CFrame.fromEulerAnglesXYZ(math.rad( 0 ),math.rad( 0 ),math.rad( 0 )) |
13 | p.CFrame = p.CFrame+Vector 3. new( 0 , 0.5 , 0 ) |