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: vECTOR 3 iSSUES

Previous Thread :: Next Thread 
theuntimelydoctor is not online. theuntimelydoctor
Joined: 30 Jun 2011
Total Posts: 718
21 Sep 2012 05:28 PM
How do I make it so instead of making a new vector 3 you just add 20 to the the y of the current vector 3 (for up) (And for the down -20)

Here is the current script

workspace.Dialog.DialogChoiceSelected:connect(function(player,choice)
if choice.Name == "Up" then
player:MoveTo(Vector3.new(0, 100, 0))
else if choice.Name == "Down" then
player:MoveTo(Vector3.new(0, 100, 0))
end
end)
Report Abuse
theuntimelydoctor is not online. theuntimelydoctor
Joined: 30 Jun 2011
Total Posts: 718
21 Sep 2012 05:28 PM
Wrong script here is the right one


workspace.Scotty.Head.Dialog.DialogChoiceSelected:connect(function(player,choice)
if choice.Name == "Up" then
player:MoveTo(Vector3.new(0, 100, 0))
else if choice.Name == "Down" then
player:MoveTo(Vector3.new(0, 100, 0))
end
end)
Report Abuse
L2000 is not online. L2000
Joined: 03 Apr 2008
Total Posts: 77448
21 Sep 2012 05:31 PM
Inside the character, get the Torso's position. Then, you can set the position using:
part.Position = part.Position + Vector3.new(0, 20, 0)

To add 20 to the Y coordinate, and for subtracting, replace the + with -.

Also, you have a problem in there; instead of your 'else if' (with the space), you should make it all one word (elseif). That will make it so you don't need to add another end.

So, your script would be:

workspace.Dialog.DialogChoiceSelected:connect(function(player,choice)
if choice.Name == "Up" and player.Character then
player.Character.Torso.Position = player.Character.Torso.Position + Vector3.new(0, 20, 0)
elseif choice.Name == "Down" then
player.Character.Torso.Position = player.Character.Torso.Position - Vector3.new(0, 20, 0)
end
end)
Report Abuse
theuntimelydoctor is not online. theuntimelydoctor
Joined: 30 Jun 2011
Total Posts: 718
21 Sep 2012 05:40 PM
Thanks :D, but my torso flys up but not me causing my death.
Report Abuse
theuntimelydoctor is not online. theuntimelydoctor
Joined: 30 Jun 2011
Total Posts: 718
21 Sep 2012 05:54 PM
Bump
Report Abuse
theuntimelydoctor is not online. theuntimelydoctor
Joined: 30 Jun 2011
Total Posts: 718
21 Sep 2012 06:08 PM
Please

Bring
Up
My
Problem
Report Abuse
xXTheRobotXx is not online. xXTheRobotXx
Joined: 05 May 2012
Total Posts: 13343
21 Sep 2012 06:10 PM
CFrame the torso so it doesn't kill you.
Report Abuse
theuntimelydoctor is not online. theuntimelydoctor
Joined: 30 Jun 2011
Total Posts: 718
21 Sep 2012 06:11 PM
Is there a way to do pure scripting because I haven't had the time to learn c-framing
Report Abuse
xXTheRobotXx is not online. xXTheRobotXx
Joined: 05 May 2012
Total Posts: 13343
21 Sep 2012 06:12 PM
workspace.Dialog.DialogChoiceSelected:connect(function(player,choice)
if choice.Name == "Up" and player.Character then
player.Character.Torso.CFrame = player.Character.Torso.Position + Vector3.new(0, 20, 0)
elseif choice.Name == "Down" then
player.Character.Torso.CFrame = Character.Torso.Position + Vector3.new(0, 20, 0)
end
end)
Report Abuse
theuntimelydoctor is not online. theuntimelydoctor
Joined: 30 Jun 2011
Total Posts: 718
21 Sep 2012 06:19 PM
Workspace.Scotty.Head.Dialog.Script:3: bad argument #3 to '?' (CFrame expected, got userdata)
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
21 Sep 2012 06:21 PM

workspace.Dialog.DialogChoiceSelected:connect(function(player,choice)
if choice.Name == "Up" and player.Character then
player.Character.Torso.CFrame = player.Character.Torso.CFrame + Vector3.new(0, 20, 0)
elseif choice.Name == "Down" then
player.Character.Torso.CFrame = Character.Torso.CFrame+ Vector3.new(0, 20, 0)
end
end)

¤ ¤ † K M X D † ¤ ¤
Report Abuse
xXTheRobotXx is not online. xXTheRobotXx
Joined: 05 May 2012
Total Posts: 13343
21 Sep 2012 06:21 PM
Thanks knightmare, that fixed my other script too.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
21 Sep 2012 06:22 PM
No problem. If anyone still needs help with CFrame:

http://wiki.roblox.com/index.php/CFrame

¤ ¤ † K M X D † ¤ ¤
Report Abuse
theuntimelydoctor is not online. theuntimelydoctor
Joined: 30 Jun 2011
Total Posts: 718
21 Sep 2012 06:28 PM
Thanks you so much! There were a few output errors in yours but I patched them up and it is perfect (I also had to change a + to a -) Thanks so much!
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
21 Sep 2012 06:44 PM
You're very welcome.

¤ ¤ † K M X D † ¤ ¤
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