The title might be confusing, but I'm trying to make it so that if the players Y axis is below 466, then a drinking code executes. The problem is that it doesn't detect where the players Y axis is at... It just executes early.
Here's the script.
game.Players.PlayerAdded:connect(function(ply)
ply.CharacterAdded:connect(function(char)
char:WaitForChild("Torso")
local torso = char.Torso
torso.Changed:connect(function()
if torso.Position.Y <= 466.943 then
print("Player is at drinking distance")
end
end)
end)
end)
The post has been answered now. Although it is Redbullusa who answered my question, I would like to thank Goulstem too.

3 comments
Well because Position.y is wrong.
Even so, it does not work.
Don't use the "Changed" event on Position properties. Rather, use a "while" loop to check if the player's torso is on/below the intended intercept.