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 » Scripting Helpers
Home Search
 

Re: lookVector problems

Previous Thread :: Next Thread 
sb901 is not online. sb901
Joined: 09 Sep 2012
Total Posts: 6
19 Sep 2012 03:42 PM
I want the brick to face the torso every time, but I'm not sure ho to write that correctly.

while true do
wait(0.3)
g=game.Players:GetChildren()
for i = 1, #g do
x=g[i].Character.Torso.Position.X
y=g[i].Character.Torso.Position.Y
z=g[i].Character.Torso.Position.Z
p=Instance.new("Part",g[i].Character.Torso)
p.Size=Vector3.new(4,1,10)
p.CFrame=CFrame.new(x,y-3.5,z) * CFrame.Angles(math.rad(0),math.rad(tostring(g[i].Character.Torso.CFrame.lookVector),math.rad(0)))
p.Anchored=true
p.BrickColor=BrickColor.Random()
p.Material="Ice"
end
end


Output:
16:40:18.534 - Workspace.Script:10: bad argument #1 to 'rad' (number expected, got string)
16:40:18.535 - Script "Workspace.Script", Line 10
16:40:18.536 - stack end
Report Abuse
MonkeyForBananas is not online. MonkeyForBananas
Joined: 17 Sep 2012
Total Posts: 52
19 Sep 2012 03:53 PM
math.rad is only for the x value.
Report Abuse
MonkeyForBananas is not online. MonkeyForBananas
Joined: 17 Sep 2012
Total Posts: 52
19 Sep 2012 03:53 PM
Lolololol fail.

~squiggy fail~
Report Abuse
sb901 is not online. sb901
Joined: 09 Sep 2012
Total Posts: 6
19 Sep 2012 03:58 PM
Do you know how to fix it?
Report Abuse
sb901 is not online. sb901
Joined: 09 Sep 2012
Total Posts: 6
19 Sep 2012 04:09 PM
bump
Report Abuse
sb901 is not online. sb901
Joined: 09 Sep 2012
Total Posts: 6
19 Sep 2012 04:26 PM
bump
Report Abuse
builderman1171 is not online. builderman1171
Joined: 27 Mar 2010
Total Posts: 1595
19 Sep 2012 04:33 PM
@MonkeyForBananas

math.rad() means radians. Because...

2(3.1415) is 360 degrees.

3.1415 is 180 degrees. But let's say you didn't know that. What would we do, you would use math.rad() to convert numbers to radians. Example:

block.CFrame=CFrame.Angles(math.rad(90),math.rad(90),math.rad(90))

That will rotate it 90 degrees each way, BUT you could ALSO do this:

block.CFrame=CFrame.Angles(3.1415/2,3.1415/2,3.1415/2)

Which would give Pi/2

which is 1.5707

-> Siggy pooped by the power of Ponies <-
Report Abuse
sb901 is not online. sb901
Joined: 09 Sep 2012
Total Posts: 6
19 Sep 2012 04:37 PM
Can someone please help me fix this?
Report Abuse
sb901 is not online. sb901
Joined: 09 Sep 2012
Total Posts: 6
19 Sep 2012 05:12 PM
bump...
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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