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: I suck with vector3 >.<

Previous Thread :: Next Thread 
drahsid5 is not online. drahsid5
Joined: 13 May 2011
Total Posts: 3937
25 Aug 2013 09:27 AM
while true do
script.Parent.Vector3.Y =- 0.1
wait(0.1)
script.Parent.Vector3.Y =- 0.1
wait(0.1)
script.Parent.Vector3.Y =- 0.1
wait(0.1)
script.Parent.Vector3.Y =- 0.1
wait(0.1)
script.Parent.Vector3.Y =- 0.1
wait(0.1)
script.Parent.Vector3.Y =+ 1
wait(0.1)
script.Parent.Vector3.Y =+ 1
wait(0.1)
script.Parent.Vector3.Y =+ 1
wait(0.1)
script.Parent.Vector3.Y =+ 1
wait(0.1)
script.Parent.Vector3.Y =+ 1
wait(0.1)
end
-- =+ and =- might be wrong?
Report Abuse
mrwar117 is not online. mrwar117
Joined: 16 Oct 2009
Total Posts: 224
25 Aug 2013 09:30 AM
you cant just do vector3.y you have to do (0,+1,0)
Report Abuse
Hibobb is not online. Hibobb
Joined: 18 Apr 2010
Total Posts: 2146
25 Aug 2013 09:30 AM
Try this;

for a = 1,5 do
script.Parent.Vector3.Y = (script.Parent.Vector3.Y - 0.1)
wait(.1)
end
wait(.1)
for b = 1,5 do
script.Parent.Vector3.Y = (script.Parent.Vector3.Y + 1)
wait(.1)
end

Age of War Forum: [http://www.roblox.com/Forum/ShowPost.aspx?PostID=110718198] Working on classes
Report Abuse
drahsid5 is not online. drahsid5
Joined: 13 May 2011
Total Posts: 3937
25 Aug 2013 09:30 AM
wouldn't that change the X and Z to 0?
Report Abuse
drahsid5 is not online. drahsid5
Joined: 13 May 2011
Total Posts: 3937
25 Aug 2013 09:31 AM
That loop >.< I should've done that instead of making a bunch of pointless lines =P
Report Abuse
Digitalizing is not online. Digitalizing
Joined: 13 Aug 2013
Total Posts: 1057
25 Aug 2013 09:32 AM
Instead of 0, do Vector3.x, +1, Vector3.z
Report Abuse
lupine is not online. lupine
Joined: 24 Jun 2008
Total Posts: 3561
25 Aug 2013 09:36 AM
A Vector3 is a set of points that can be used as details in a 3d world. The following are a few examples of properties that need a Vector3 value:
Position
Rotation
Velocity
RotVelocity

Now to change one of these properties, you have to set it equal to a new Vector3 value, so like this:

workspace.Part.Position = Vector3.new(0,0,0)


But I noticed you had a - and + before each one, so I'm assuming you'd like to add or subtract these values. Try this:

workspace.Part.Position = workspace.Part.Position + Vector3.new(0,0.1,0)
or
workspace.Part.Position = workspace.Part.Position - Vector3.new(0,0.1,0)


There's a problem with this, though. Using the position property, if a block moves, it'll automatically move ontop of any block it comes in contact with. To fix this, we use CFrame.

CFrame is essentially a "superposition" -- it controls it's exact 3d position and it's rotation.

Using CFrame is quite easy - we just need to set the parts CFrame property to a new CFrame value.

workspace.Part.CFrame = CFrame.new(0,0,0)

however, you wouldn't ever subtract or add a new CFrame value, you'd have to do that with a Vector3 value.

workspace.Part.CFrame = CFrame.new(0,0,0) + Vector3.new(0,0.1,0)


Let me know if you have any other questions. C:
Report Abuse
drahsid5 is not online. drahsid5
Joined: 13 May 2011
Total Posts: 3937
25 Aug 2013 09:36 AM
@hib, you can't do that, vector3 is not a valid member of part would show up in the output.
@dig, I'll try that.
Report Abuse
drahsid5 is not online. drahsid5
Joined: 13 May 2011
Total Posts: 3937
25 Aug 2013 09:38 AM
@ lup, Thats very helpful, I'll try that C:
Report Abuse
Hibobb is not online. Hibobb
Joined: 18 Apr 2010
Total Posts: 2146
25 Aug 2013 09:38 AM
I didnt assume you were changing the position. I just copied your script and helped you with the loop. Its not good to assume what the person is trying to do if they dont tell you ;)

Age of War Forum: [http://www.roblox.com/Forum/ShowPost.aspx?PostID=110718198] Working on classes
Report Abuse
drahsid5 is not online. drahsid5
Joined: 13 May 2011
Total Posts: 3937
25 Aug 2013 09:42 AM
@hib, I'm sorry if I sounded mean, or offended you D:
Report Abuse
drahsid5 is not online. drahsid5
Joined: 13 May 2011
Total Posts: 3937
25 Aug 2013 09:45 AM
@lup, I tried this and studio stops responding in solo mode .-. which is weird because my comp is high end:

while true do
script.Parent.CFrame = CFrame.new(0,0,0) + Vector3.new(0,0.1,0)
script.Parent.CFrame = CFrame.new(0,0,0) + Vector3.new(0,0.1,0)
script.Parent.CFrame = CFrame.new(0,0,0) + Vector3.new(0,0.1,0)
script.Parent.CFrame = CFrame.new(0,0,0) + Vector3.new(0,0.1,0)
script.Parent.CFrame = CFrame.new(0,0,0) + Vector3.new(0,0.1,0)
script.Parent.CFrame = CFrame.new(0,0,0) - Vector3.new(0,0.1,0)
script.Parent.CFrame = CFrame.new(0,0,0) - Vector3.new(0,0.1,0)
script.Parent.CFrame = CFrame.new(0,0,0) - Vector3.new(0,0.1,0)
script.Parent.CFrame = CFrame.new(0,0,0) - Vector3.new(0,0.1,0)
script.Parent.CFrame = CFrame.new(0,0,0) - Vector3.new(0,0.1,0)
end
Report Abuse
drahsid5 is not online. drahsid5
Joined: 13 May 2011
Total Posts: 3937
25 Aug 2013 09:47 AM
w8, its missing the wait()
Report Abuse
Digitalizing is not online. Digitalizing
Joined: 13 Aug 2013
Total Posts: 1057
25 Aug 2013 09:48 AM
That's not how you change CFrame :P
Report Abuse
strongalphawarrior is not online. strongalphawarrior
Joined: 27 Jun 2011
Total Posts: 1000
25 Aug 2013 09:49 AM
...
Report Abuse
lupine is not online. lupine
Joined: 24 Jun 2008
Total Posts: 3561
25 Aug 2013 09:50 AM
It is, however what you're doing is setting the CFrame = 0,0,0 then adding 0.1 to the y

if you want to make it appear like it's "floating", try this

while wait() end
for i = 1, 10 do
workspace.Part.CFrame = workspace.Part.CFrame + Vector3.new(0,0.1,0)
wait()
end
for i = 1, 10 do
workspace.Part.CFrame = workspace.Part.CFrame + Vector3.new(0,-0.1,0) -- only add negatives. :3
wait()
end
end
Report Abuse
drahsid5 is not online. drahsid5
Joined: 13 May 2011
Total Posts: 3937
25 Aug 2013 09:50 AM
It worked, sorta, its inside the surrounding bricks >.<
Report Abuse
drahsid5 is not online. drahsid5
Joined: 13 May 2011
Total Posts: 3937
25 Aug 2013 09:52 AM
@lup, "do expected near end"
Report Abuse
lupine is not online. lupine
Joined: 24 Jun 2008
Total Posts: 3561
25 Aug 2013 09:52 AM
oops, the first line: "while wait() end"

change that to "while wait() do"
Report Abuse
drahsid5 is not online. drahsid5
Joined: 13 May 2011
Total Posts: 3937
25 Aug 2013 09:55 AM
@lup, Can I use script.Parent, many parts are named... "Part" and after about 15 seconds roblox crashed, I think I need to add a "wait()"
Report Abuse
strongalphawarrior is not online. strongalphawarrior
Joined: 27 Jun 2011
Total Posts: 1000
25 Aug 2013 09:55 AM
Lupine
Are you sure it's four members

(0,0,0,0)
Report Abuse
drahsid5 is not online. drahsid5
Joined: 13 May 2011
Total Posts: 3937
25 Aug 2013 09:56 AM
oh wait xD there are "wait()"s
Report Abuse
shonclub is not online. shonclub
Joined: 05 Sep 2009
Total Posts: 1331
25 Aug 2013 09:56 AM
for i = 1,5 do
script.Parent.CFrame = script.Parent.CFrame - Vector3.new(0,0.1,0)
wait(0.1)
for i = 1,5 do
script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,0.1,0)
wait(0.1)
end
Report Abuse
strongalphawarrior is not online. strongalphawarrior
Joined: 27 Jun 2011
Total Posts: 1000
25 Aug 2013 09:57 AM
Lol saw . As , sury
Report Abuse
shonclub is not online. shonclub
Joined: 05 Sep 2009
Total Posts: 1331
25 Aug 2013 09:57 AM
Oops, forgot the ends

for i = 1,5 do
script.Parent.CFrame = script.Parent.CFrame - Vector3.new(0,0.1,0)
wait(0.1)
end
for i = 1,5 do
script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,0.1,0)
wait(0.1)
end
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