gangman67
|
  |
| Joined: 04 Jun 2011 |
| Total Posts: 798 |
|
|
| 19 Jan 2016 03:45 PM |
| How would I fire a function when they players position changes? |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 19 Jan 2016 03:48 PM |
Player.Character.Torso.Changed:connect(function(property) local value = Player.Character[property] print("Torso's " .. property .. " changed to " .. tostring(value)) end)
|
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 19 Jan 2016 03:50 PM |
Sorry! I really need to learn to proofread. Make sure Player is properly referenced, and this will fire every time it changes. You probably want a debounce on there - otherwise it will be information overload. You can adapt this to look JUST at the positional coordinates if you desire. but this will give you every change of every property in the Torso.
Player.Character.Torso.Changed:connect(function(property) local value = Player.Character.Torso[property] print("Torso's " .. property .. " changed to " .. tostring(value)) end)
|
|
|
| Report Abuse |
|
|
gangman67
|
  |
| Joined: 04 Jun 2011 |
| Total Posts: 798 |
|
| |
|
gangman67
|
  |
| Joined: 04 Jun 2011 |
| Total Posts: 798 |
|
|
| 19 Jan 2016 04:02 PM |
| lol I am so dumb sometimes, I was thinking that it would fire every second an I thought of a better way to do what i need |
|
|
| Report Abuse |
|
|
|
| 19 Jan 2016 04:08 PM |
| The Changed event fires whenever the specified object changes, although it has some bugs sometimes on what it likes to pick up. Like, I've noticed that sometimes it doesn't like to pick up changes in Velocity or Position, not sure about other things. It doesn't have to be looped to fire all the time, because it fires when that object changes. :P |
|
|
| Report Abuse |
|
|
gangman67
|
  |
| Joined: 04 Jun 2011 |
| Total Posts: 798 |
|
|
| 19 Jan 2016 04:09 PM |
| Lol, fail again qq Ok so I am making a sea and when a player gets in the sea They are supposed to be able to swim, I need to make a body position when they get to a certain point On the Y how would I do this without spamming functions a bunch of while loops, I was going to try OnTouch but its a mesh qq |
|
|
| Report Abuse |
|
|
gangman67
|
  |
| Joined: 04 Jun 2011 |
| Total Posts: 798 |
|
|
| 19 Jan 2016 04:10 PM |
| OH WAIT could Humanoid.FallingDown:connect work? |
|
|
| Report Abuse |
|
|
|
| 19 Jan 2016 04:35 PM |
| Well, depending on how you have it set up, you could just make it so that when a player's torso position goes below a certain height, it enables whatever you're having happen to make them swim. Although, in order for that to be a way around, your water would have to be limited to being underneath the lowest floor that the player can stand on. |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 19 Jan 2016 04:37 PM |
Look at Davidii's survival 303 - I believe you can find an uncopylocked version, or a free model of the whole place.
If you jump into the ocean, you'll swim right back up. Has something to do with BodyVelocities and locking position on the y-axis.
|
|
|
| Report Abuse |
|
|