Dragging objects with the mouse

Forgive me as i am quite new to scripting but:

Adding a maximum range to the object seems to break everything

mouse.Target.Position = mouse.Hit.Position.Unit * 20
when I do that i get the error
players.crolaa.PlayerScripts.LocalScript:18: attempt to index nil with ‘Position’

So first i thought, hey maybe I typed something in wrong, eventually got to the point of retyping everything then just copy and pasting.

None of which fixed or helped at all.

I have no clue what is causing this and would appreciate some help.

Great tutorial by the way, Very useful stuff.

3 Likes