|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 21 Sep 2012 05:40 PM |
| Thanks :D, but my torso flys up but not me causing my death. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 21 Sep 2012 06:10 PM |
| CFrame the torso so it doesn't kill you. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 21 Sep 2012 06:19 PM |
| Workspace.Scotty.Head.Dialog.Script:3: bad argument #3 to '?' (CFrame expected, got userdata) |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 21 Sep 2012 06:21 PM |
| Thanks knightmare, that fixed my other script too. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 21 Sep 2012 06:44 PM |
You're very welcome.
¤ ¤ † K M X D † ¤ ¤ |
|
|
| Report Abuse |
|
|