|
| 05 Jan 2017 06:35 PM |
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() while true do local direction = CFrame.new(workspace.Part.Position, Mouse.hit.p) list=workspace:GetChildren() for i=1,#list do if list[i].Name=="Part" then list[i].direction --list[i].CFrame=list[i].CFrame*direction end end wait() end
The script, as is right now, will rotate all objects in workspace named "Part" towards where the mouse is pointing, but it overrides their position. How do I keep the positions of the parts while rotating?
|
|
|
| Report Abuse |
|
|
Metexrr
|
  |
| Joined: 29 Sep 2012 |
| Total Posts: 135 |
|
|
| 05 Jan 2017 06:40 PM |
part.CFrame = part.CFrame *CFrame.Angles(vec3val)
|
|
|
| Report Abuse |
|
|
|
| 05 Jan 2017 06:43 PM |
^^ Thanks, but that made me realise I have to update direction.
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() while true do list=workspace:GetChildren() for i=1,#list do if list[i].Name=="Part" then local direction = CFrame.new(list[i].Position, Mouse.hit.p) list[i].CFrame=direction end end wait() end
works now, thanks |
|
|
| Report Abuse |
|
|
Metexrr
|
  |
| Joined: 29 Sep 2012 |
| Total Posts: 135 |
|
| |
|