generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Make Brick Face Direction of Mouse?

Previous Thread :: Next Thread 
Gladii is not online. 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 is not online. Gladii
Joined: 10 Mar 2012
Total Posts: 1713
08 Jul 2015 06:23 PM
HELP
Report Abuse
rayk999 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. Gladii
Joined: 10 Mar 2012
Total Posts: 1713
08 Jul 2015 06:47 PM
This problem is for both scripts.
Report Abuse
Goulstem is not online. 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 is not online. 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 is not online. Gladii
Joined: 10 Mar 2012
Total Posts: 1713
08 Jul 2015 07:12 PM
any help on fixing this?
Report Abuse
rayk999 is not online. 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 is not online. 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 is not online. Gladii
Joined: 10 Mar 2012
Total Posts: 1713
08 Jul 2015 07:31 PM
Nothing?
Report Abuse
rayk999 is not online. rayk999
Joined: 18 Feb 2011
Total Posts: 4705
08 Jul 2015 07:32 PM
Localscript in StarterGui
Report Abuse
Gladii is not online. Gladii
Joined: 10 Mar 2012
Total Posts: 1713
08 Jul 2015 07:36 PM
Just has the same error as before
Report Abuse
rayk999 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
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 is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
08 Jul 2015 08:14 PM
@thedestroyer115
Welcome to Scripters 2015!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image