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
 

How to call 'Y' in position?

Previous Thread :: Next Thread 
drmiewlo is not online. drmiewlo
Joined: 14 Mar 2012
Total Posts: 1782
13 Oct 2011 03:45 PM
You know how in the position if you click the plus next to it in properties? How would I use that in a script, I've tried Position.Y and Y.Position and they havn't worked.
Report Abuse
BenBonez is not online. BenBonez
Joined: 29 Aug 2008
Total Posts: 19362
13 Oct 2011 03:46 PM
Position.Y should work, but you can't directly assign to it, you can only get the value.
Report Abuse
drmiewlo is not online. drmiewlo
Joined: 14 Mar 2012
Total Posts: 1782
13 Oct 2011 03:47 PM
I've tried this but it doesn't work:

repeat
O.CFrame = O.CFrame + Vector3.new(0,0.1,0)
H.CFrame = H.CFrame + Vector3.new(0,0.1,0)
V.CFrame = V.CFrame + Vector3.new(0,0.1,0)
wait(.005)
until O.Position.Y > 12
Report Abuse
Wil2 is not online. Wil2
Joined: 01 Feb 2008
Total Posts: 728
13 Oct 2011 03:51 PM
problem is with line 2: you can't use CFrame + Vector3.new(), here's it fix:
repeat
O.CFrame = O.CFrame * CFrame.new(0,0.1,0)
H.CFrame = H.CFrame * CFrame.new(0,0.1,0)
V.CFrame = V.CFrame * CFrame.new(0,0.1,0)
wait(.005)
until O.Position.Y > 12
Report Abuse
BenBonez is not online. BenBonez
Joined: 29 Aug 2008
Total Posts: 19362
13 Oct 2011 03:51 PM
"wait(.005)"

If I remember right that is lower than what is possible.
Just use "wait()" when in doubt.

As for the rest of the Script I see no problem with it.
Report Abuse
skipperguy12 is not online. skipperguy12
Joined: 09 Oct 2009
Total Posts: 955
13 Oct 2011 03:52 PM
Like Ben said, you cant "change" the value directly...
Report Abuse
Wil2 is not online. Wil2
Joined: 01 Feb 2008
Total Posts: 728
13 Oct 2011 03:52 PM
it's not the "wait" that's breaking it, I fixed it.
Report Abuse
BenBonez is not online. BenBonez
Joined: 29 Aug 2008
Total Posts: 19362
13 Oct 2011 03:52 PM
@Wil2

Actually he can.
A Part has a CFrame and a Position property.
CFrame consists of the Position and the Orientation/Rotation so you can always add to the Position.
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
13 Oct 2011 03:53 PM
@Wil
Yes you can.
Report Abuse
Wil2 is not online. Wil2
Joined: 01 Feb 2008
Total Posts: 728
13 Oct 2011 03:54 PM
ya but, if your changing the position using CFrame, you can't do + Vector3.new() it only works if your changing pos with the position prop, for cframe, to add cframe to an existing cframe, you use * CFrame.new()
Report Abuse
BenBonez is not online. BenBonez
Joined: 29 Aug 2008
Total Posts: 19362
13 Oct 2011 03:55 PM
@Wil2

He already had it working perfectly so forget about your idea of it not working.
The problem is the call of the Position.Y.
Report Abuse
Wil2 is not online. Wil2
Joined: 01 Feb 2008
Total Posts: 728
13 Oct 2011 03:57 PM
actually this works:
repeat
O.CFrame = O.CFrame + Vector3.new(0,0.1,0)
H.CFrame = H.CFrame + Vector3.new(0,0.1,0)
V.CFrame = V.CFrame + Vector3.new(0,0.1,0)
wait(.005)
until O.Position.Y > 12
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
13 Oct 2011 03:58 PM
@Wil

You can add a Vector3 to a CFrame to increase a CFrame. Just as CFrame moves a brick into another brick, adding a Vector3 to a CFrame does the same thing.
Report Abuse
drmiewlo is not online. drmiewlo
Joined: 14 Mar 2012
Total Posts: 1782
13 Oct 2011 04:04 PM
@Wil changing the '+' and '-' to '*' didn't work. It says got playerstat but expected something else.
Report Abuse
Wil2 is not online. Wil2
Joined: 01 Feb 2008
Total Posts: 728
13 Oct 2011 04:09 PM
are you sure your trying to move a brick and not a gui?
Report Abuse
drmiewlo is not online. drmiewlo
Joined: 14 Mar 2012
Total Posts: 1782
13 Oct 2011 04:14 PM
Its a brick, S'posed to go up until it hits the max.
Report Abuse
Wil2 is not online. Wil2
Joined: 01 Feb 2008
Total Posts: 728
13 Oct 2011 04:15 PM
is O, H, V defined?
Report Abuse
Wil2 is not online. Wil2
Joined: 01 Feb 2008
Total Posts: 728
13 Oct 2011 04:15 PM
like:
O,H,V = workspace.P1,workspace.P2,workspace.P3
Report Abuse
drmiewlo is not online. drmiewlo
Joined: 14 Mar 2012
Total Posts: 1782
13 Oct 2011 04:21 PM
Yah, they are, here's the full script:

script.Parent.Touched:connect(function(hit)
if script.Parent.Active.Value == false then
humanoid = hit.Parent:FindFirstChild("Humanoid")
torso = hit.Parent:FindFirstChild("Torso")
if humanoid then
H = script.Parent
V = script.Parent.Parent.Vert
O = script.Parent.Parent.Orb
if torso then
script.Parent.Active.Value = true
H.Spin.Disabled = false
V.Spin.Disabled = false
torso.Anchored = true
scrpt = script.Parent.Pos:Clone()
scrpt.Parent = torso
scrpt.Disabled = false
repeat
O.CFrame = O.CFrame * Vector3.new(0,0.1,0)
H.CFrame = H.CFrame * Vector3.new(0,0.1,0)
V.CFrame = V.CFrame * Vector3.new(0,0.1,0)
wait(.005)
until O.Position.Y > 13
repeat
O.CFrame = O.CFrame * Vector3.new(0,-0.1,0)
H.CFrame = H.CFrame * Vector3.new(0,-0.1,0)
V.CFrame = V.CFrame * Vector3.new(0,-0.1,0)
wait(.005)
until O.Position.Y < 7
torso.Pos:Remove()
torso.Anchored = false
H.Spin.Disabled = true
V.Spin.Disabled = true
end
wait(10)
script.Parent.Active.Value = false
end
end
end)

pos is a script that makes sure the player's torso is in the same position of the sphere, there's nothing wrong with it though, I'm positive.
Report Abuse
drmiewlo is not online. drmiewlo
Joined: 14 Mar 2012
Total Posts: 1782
13 Oct 2011 04:23 PM
script.Parent.Touched:connect(function(hit)
if script.Parent.Active.Value == false then
humanoid = hit.Parent:FindFirstChild("Humanoid")
torso = hit.Parent:FindFirstChild("Torso")
if humanoid then
H = script.Parent
V = script.Parent.Parent.Vert
O = script.Parent.Parent.Orb
if torso then
script.Parent.Active.Value = true
H.Spin.Disabled = false
V.Spin.Disabled = false
torso.Anchored = true
scrpt = script.Parent.Pos:Clone()
scrpt.Parent = torso
scrpt.Disabled = false
---------------------------------------------------------Wrong part below!
repeat
O.CFrame = O.CFrame * Vector3.new(0,0.1,0)
H.CFrame = H.CFrame * Vector3.new(0,0.1,0)
V.CFrame = V.CFrame * Vector3.new(0,0.1,0)
wait(.005)
until O.Position.Y > 13
repeat
O.CFrame = O.CFrame * Vector3.new(0,-0.1,0)
H.CFrame = H.CFrame * Vector3.new(0,-0.1,0)
V.CFrame = V.CFrame * Vector3.new(0,-0.1,0)
wait(.005)
until O.Position.Y < 7
----------------------------------------------------
torso.Pos:Remove()
torso.Anchored = false
H.Spin.Disabled = true
V.Spin.Disabled = true
end
wait(10)
script.Parent.Active.Value = false
end
end
end)

Report Abuse
drmiewlo is not online. drmiewlo
Joined: 14 Mar 2012
Total Posts: 1782
13 Oct 2011 04:57 PM
bump
Report Abuse
drmiewlo is not online. drmiewlo
Joined: 14 Mar 2012
Total Posts: 1782
13 Oct 2011 05:42 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