So I run a script that gives me the Y position of a part activated by a Changed event.
script.Parent.Changed:Connect(function() local y = script.Parent.Position.Y print(y) end)
I also run a script that makes the part go up
for i = 0,2,x do wait() script.Parent:TranslateBy(Vector3.new(0,i,0))
end
then I have a script that unanchors the part
script.Parent.Anchored = false
When I run the script, it functions perfectly on the way up, giving me the Y position on the way up. But when it starts falling, it stops outputting values. Does the changed event not fire on the effect of gravity? If so is there any way to make the script fire as its falling?
The Changed
event is immune to ROBLOX physics.
What this means, is that if you change a part's properties through a script, it will trigger the event. However, if you let a part simply fall or interact with other parts, it will not trigger the event.
To get around this, you need to do one of two things:
What I mean for the second one, is you want to pretty much check the position every fraction of a second, and use that position accordingly. However, you do not want to check the position every fraction of a second for your entire game, as this can be heavy on server resources.
To counteract this, determine roughly how long it takes the part to fall, and check the position every increment until your goal time is reached.
unanchor part -> loop -> check position -> wait increment -> end