I've been trying to do this code:
local newPosition = Mouse.Target
but I get some error about it being an object and not a Vector3 when I assign it to things like
part = newPosition.
Any solutions?
I've been trying to do this code:
local newPosition = Mouse.Target
but I get some error about it being an object and not a Vector3 when I assign it to things like
part = newPosition.
Any solutions?
Mouse.Target is the object in 3D space the mouse is pointing to.
For example, if the mouse rests on a brick, the target would be the name of the brick.
print(mouse.Target)
Output: Part
If you want to use the position of the mouse, try mouse.Hit.Position.
local newPosition = mouse.Hit.Position
part.Position = newPosition
Cheers.
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
https://developer.roblox.com/en-us/api-reference/class/Mouse
Oh thanks, I didnt realize that. The name "target" is kind of misleading, lol.
Target isn't the string name of the object the mouse is resting on, print just defaults to it to name object values.