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 » Scripters
Home Search
 

Re: How do we check the position of something?

Previous Thread :: Next Thread 
OnePieceOA is not online. OnePieceOA
Joined: 12 Jul 2015
Total Posts: 1
11 Aug 2015 09:17 PM
This doesn't work. vvvv

while true do

for i,v in pairs(game.Players:GetChildren()) do
if v.Character:WaitForChild("Torso").Position.Y == -10 then
print("works")
v.Character.Torso.Anchored = true
end
end

wait()
end

I was wondering, why. But then I looked at my torso's position. And my torso's position stays still, even if i'm walking. So how do we check the worlds position?
Report Abuse
CaptainGector is not online. CaptainGector
Joined: 02 May 2014
Total Posts: 487
11 Aug 2015 09:31 PM
Here ya go!



wait(1) -- I added this to make sure that there are players loaded.

while true do

for i,v in pairs(game.Players:GetChildren()) do
print(v.Name .. "'s torso.Position.Y = " .. v.Character:FindFirstChild("Torso").Position.Y)
if v.Character:WaitForChild("Torso").Position.Y == -10 then
print("works")
v.Character.Torso.Anchored = true
end
end

wait()
end
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
11 Aug 2015 09:33 PM
or use the .PlayerAdded event to be more safe

game.Players.PlayerAdded:wait()

while wait() do

if game.Players.NumPlayers == 0 then
game.Players.PlayerAdded:wait()
end

for i,v in pairs(game.Players:GetChildren()) do
print(v.Name .. "'s torso.Position.Y = " .. v.Character:FindFirstChild("Torso").Position.Y)
if v.Character:WaitForChild("Torso").Position.Y == -10 then
print("works")
v.Character.Torso.Anchored = true
end
end

wait()
end

Report Abuse
CaptainGector is not online. CaptainGector
Joined: 02 May 2014
Total Posts: 487
11 Aug 2015 10:04 PM
^ IWAKB!

(INSTAWIN ALWAYS KNOWS BEST)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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