So I'm experimenting with The Mouse 'Hit' (the CFrame of where the mouse is), and I"m trying to make this one part move by changing the property 'position' in BodyPosition in the block.
I don't know how I can get the CFrame information and put it into a Vector3 format for the 'position' property of BodyPosition
This is the script
01 | local player = game.Players.LocalPlayer |
02 | local mouse = player:GetMouse() --Getting the player's mouse |
03 | local move = game.Workspace.Move |
04 |
05 | mouse.Move:connect( function () --When the mouse moves |
06 | while true do wait() |
07 | local target = mouse.Hit |
08 | if target = = nil then |
09 | return |
10 | end |
11 | move.BodyPosition.position = Vector 3. new(target) |
12 | end |
13 | end ) |
Very simply, the position
portion (a Vector3) is stored in the p
property of CFrame objects!
In line 11 there, replace Vector3.new(target)
with target.p
!
Remember, the p
is lowercase. Lua is case-sensitive.