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: Move Position of brick Script Help

Previous Thread :: Next Thread 
halo9789 is not online. halo9789
Joined: 17 Nov 2010
Total Posts: 86
17 Aug 2013 11:23 PM
If i had a brick named a and wanted to move it's y axis up 1 (It is at 2 now so i want to move it to 3),would i type this?

a.Position = Vector0.new

I think that is wrong though.
Report Abuse
MeBilly8440 is not online. MeBilly8440
Joined: 27 Jul 2009
Total Posts: 2783
17 Aug 2013 11:24 PM
If you want to move it one up no matter what X is
a.Position = a.Position + Vector3.new(0, 1, 0)

If you want to move it's X to a specific location
a.Position = Vector3.new(a.Position.X, 3, a.Position.Z)

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
halo9789 is not online. halo9789
Joined: 17 Nov 2010
Total Posts: 86
17 Aug 2013 11:25 PM
Thanks.
Report Abuse
halo9789 is not online. halo9789
Joined: 17 Nov 2010
Total Posts: 86
17 Aug 2013 11:27 PM
Could i also use -1 to make it move down?
Report Abuse
MeBilly8440 is not online. MeBilly8440
Joined: 27 Jul 2009
Total Posts: 2783
17 Aug 2013 11:28 PM
Yup

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
halo9789 is not online. halo9789
Joined: 17 Nov 2010
Total Posts: 86
17 Aug 2013 11:29 PM
So would this work to make a platform o go up and down on the click of a button.
Report Abuse
halo9789 is not online. halo9789
Joined: 17 Nov 2010
Total Posts: 86
17 Aug 2013 11:30 PM
Sorry forgot to post the script

a = script.Parent.Parent.a
function onClicked()
a.Position = a.Position + Vector3.new(0, 1, 0)
wait(1)
a.Position = a.Position + Vector3.new(0, 1, 0)
wait(1)
a.Position = a.Position + Vector3.new(0, 1, 0)
wait(1)
a.Position = a.Position + Vector3.new(0, 1, 0)
wait(1)
a.Position = a.Position + Vector3.new(0, 1, 0)
wait(1)
a.Position = a.Position + Vector3.new(0, 1, 0)
wait(1)
a.Position = a.Position + Vector3.new(0, 1, 0)
wait(1)
a.Position = a.Position + Vector3.new(0, 1, 0)
wait(5)
a.Position = a.Position + Vector3.new(0, -1, 0)
wait(1)
a.Position = a.Position + Vector3.new(0, -1, 0)
wait(1)
a.Position = a.Position + Vector3.new(0, -1, 0)
wait(1)
a.Position = a.Position + Vector3.new(0, -1, 0)
wait(1)
a.Position = a.Position + Vector3.new(0, -1, 0)
wait(1)
a.Position = a.Position + Vector3.new(0, -1, 0)
wait(1)
a.Position = a.Position + Vector3.new(0, -1, 0)
wait(1)
a.Position = a.Position + Vector3.new(0, -1, 0)
wait(1)
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
MeBilly8440 is not online. MeBilly8440
Joined: 27 Jul 2009
Total Posts: 2783
17 Aug 2013 11:30 PM
Yes, using this method would work for that.

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
halo9789 is not online. halo9789
Joined: 17 Nov 2010
Total Posts: 86
17 Aug 2013 11:31 PM
I meant the script above,i just posted it would that work?
Report Abuse
halo9789 is not online. halo9789
Joined: 17 Nov 2010
Total Posts: 86
17 Aug 2013 11:32 PM
Yay i made it work,i'm getting a little better every day :)
Report Abuse
halo9789 is not online. halo9789
Joined: 17 Nov 2010
Total Posts: 86
17 Aug 2013 11:33 PM
How would you make it move up smoother?
Report Abuse
MeBilly8440 is not online. MeBilly8440
Joined: 27 Jul 2009
Total Posts: 2783
17 Aug 2013 11:34 PM
Oops, I replied before I saw the script... anyways, yes, that should work. However, using CFrame would work a lot better, along with loops and some stuff to prevent players from clicking it a lot. Here's a nicer version:

local a = script.Parent.Parent.a
local enabled = true
script.Parent.ClickDetector.MouseClick:connect(function()
if (not enabled) then
return
end
enabled = false
for i = 1, 8 do
a.CFrame = a.CFrame + Vector3.new(0, 1, 0)
wait(1)
end
for i = 1, 8 do
a.CFrame = a.CFrame - Vector3.new(0, 1, 0)
wait(1)
end
enabled = true
end)

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
MeBilly8440 is not online. MeBilly8440
Joined: 27 Jul 2009
Total Posts: 2783
17 Aug 2013 11:35 PM
Again, I posted before I saw your replies ._. here's it smoother:

local a = script.Parent.Parent.a
local enabled = true
script.Parent.ClickDetector.MouseClick:connect(function()
if (not enabled) then
return
end
enabled = false
for i = 1, 160 do
a.CFrame = a.CFrame + Vector3.new(0, .05, 0)
wait(.05)
end
for i = 1, 160 do
a.CFrame = a.CFrame - Vector3.new(0, .05, 0)
wait(.05)
end
enabled = true
end)

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
halo9789 is not online. halo9789
Joined: 17 Nov 2010
Total Posts: 86
17 Aug 2013 11:38 PM
Yay thx,how would you change the color of a brick?
Report Abuse
MeBilly8440 is not online. MeBilly8440
Joined: 27 Jul 2009
Total Posts: 2783
17 Aug 2013 11:39 PM
a.BrickColor = BrickColor.new("Really red")
Here's a list: http://wiki.roblox.com/index.php/BrickColor_Codes

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
halo9789 is not online. halo9789
Joined: 17 Nov 2010
Total Posts: 86
17 Aug 2013 11:42 PM
Yay thx again,sorry for so many q's its just i cant really find what i wanna know on wiki.roblox.com
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