Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

How do I get a specific coordinate position of a brick? (i.e. Get the Z position specifically.)

Asked by 9 years ago
game.Players.PlayerAdded:connect(function(player)
    local character = player.Character
    if character.Head.Position >= Vector3.new(0,0,-100) then
        local dostuffhere = dostuffhere
    end
end)

That is my code so far, but I want the script to pay attention only to the Z position. I'll make it do stuff later. Thank you!

1 answer

Log in to vote
0
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
9 years ago

You can just use the Z property of Position

if character.Head.Position.Z >= -100 then

Just remember that these XYZ properties are read-only, so do NOT try to do this:

part.Position.Z = 50

That will just result in an error.

0
Thank you, this saves me a lot of trouble! dirty_catheter 7 — 9y
Ad

Answer this question