Gladii
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 1713 |
|
|
| 08 Jul 2015 05:59 PM |
| How can I make a brick face the direction of my mouse? Also how can I make it move that direction? I'm stumped. |
|
|
| Report Abuse |
|
|
Gladii
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 1713 |
|
| |
|
rayk999
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 4705 |
|
|
| 08 Jul 2015 06:25 PM |
game:GetService("RunService").RenderStepped:connect(function() part.CFrame = CFrame.new(part.Position, mouse.Hit.p) end) |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 08 Jul 2015 06:27 PM |
local mouse = game.Players.LocalPlayer:GetMouse(); local part = workspace.Part;
mouse.Move:connect(function() part.CFrame = CFrame.new(part.CFrame.p,mouse.Hit.p); end) |
|
|
| Report Abuse |
|
|
rayk999
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 4705 |
|
|
| 08 Jul 2015 06:29 PM |
@Goulstem
I don't use Mouse.Move anymore since it detects mouse movement changes on the screen, so if you were in first person mode, it wouldn't fire. |
|
|
| Report Abuse |
|
|
Gladii
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 1713 |
|
|
| 08 Jul 2015 06:39 PM |
| Players.Player.PlayerScripts.LocalScript:5: attempt to index upvalue 'part' (a function value) |
|
|
| Report Abuse |
|
|
Gladii
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 1713 |
|
|
| 08 Jul 2015 06:47 PM |
| This problem is for both scripts. |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 08 Jul 2015 06:51 PM |
@Gladii
You have to define the part dumbass
@rayk999
So you'd rather use a while loop? Lol |
|
|
| Report Abuse |
|
|
Gladii
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 1713 |
|
|
| 08 Jul 2015 06:53 PM |
local part = game.Workspace.move I have. Next time ask nicely. |
|
|
| Report Abuse |
|
|
Gladii
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 1713 |
|
| |
|
rayk999
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 4705 |
|
|
| 08 Jul 2015 07:16 PM |
@Goulstem
RenderStepped :) More performance-heavy but well worth it for me. |
|
|
| Report Abuse |
|
|
Gladii
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 1713 |
|
|
| 08 Jul 2015 07:23 PM |
| I originaly had it in StarterPlayerScripts. Moving it to ServersScriptService still didn't make it work, but it produced no output. |
|
|
| Report Abuse |
|
|
Gladii
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 1713 |
|
| |
|
rayk999
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 4705 |
|
| |
|
Gladii
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 1713 |
|
|
| 08 Jul 2015 07:36 PM |
| Just has the same error as before |
|
|
| Report Abuse |
|
|
rayk999
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 4705 |
|
|
| 08 Jul 2015 07:38 PM |
try using :WaitForChild()
workspace:WaitForChild(put your partname here) |
|
|
| Report Abuse |
|
|
Gladii
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 1713 |
|
|
| 08 Jul 2015 07:43 PM |
| Now how can I have it move on a constant speed on a 2d plane? |
|
|
| Report Abuse |
|
|
rayk999
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 4705 |
|
|
| 08 Jul 2015 07:45 PM |
game:GetService("RunService").RenderStepped:connect(function() part.CFrame = CFrame.new(part.Position, mouse.Hit.p-Vector3.new(0,mouse.Hit.p.y,0))
end) |
|
|
| Report Abuse |
|
|
rayk999
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 4705 |
|
|
| 08 Jul 2015 07:46 PM |
| I'm assuming you want to ignore the Y axis. (up/down) |
|
|
| Report Abuse |
|
|
Gladii
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 1713 |
|
|
| 08 Jul 2015 07:50 PM |
| Doesn't seem to make the brick move. And Thanks for the tremendous help. |
|
|
| Report Abuse |
|
|
Gladii
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 1713 |
|
|
| 08 Jul 2015 08:00 PM |
| I've moved the -Vector3.new(0,mouse.Hit.p.y,0) to the other paramater. I'd does't move when I point it at any part but it teleports away when I point it at the skybox. |
|
|
| Report Abuse |
|
|
rayk999
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 4705 |
|
|
| 08 Jul 2015 08:05 PM |
local part = workspace:WaitForChild("Part") local mouse = game.Players.LocalPlayer:GetMouse()
game:GetService("RunService").RenderStepped:connect(function() local p = mouse.Hit.p part.CFrame = CFrame.new(part.Position, Vector3.new(p.x,part.Position.y,p.z))
end)
make sure to change your "part" variable again |
|
|
| Report Abuse |
|
|
Gladii
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 1713 |
|
|
| 08 Jul 2015 08:09 PM |
| This doesn't move the part but it does stop the part from looking up and down on the Y-axis. I believe you will have to subtract a certain number form the first parameter to get the part to move. |
|
|
| Report Abuse |
|
|
|
| 08 Jul 2015 08:13 PM |
I wasn't going to post on this thread until I read this:
"@Gladii
You have to define the part dumbass"
Absurd. |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 08 Jul 2015 08:14 PM |
@thedestroyer115 Welcome to Scripters 2015! |
|
|
| Report Abuse |
|
|