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

How to take a position of an object and minus one of the axis?

Asked by
816i 19
7 years ago
Edited 7 years ago

So I've been working on a script for awhile but am stuck on this one bit, I want the block to be a little bit below the torso, but since

Im currently using Parts[i].CFrame = Parts[i].CFrame:lerp(game.Players.LocalPlayer.Character.Torso.CFrame-Vector3.new(0,-50,0), 0.) 

is the exact middle, how would I specifically minus an amount from the y or any value? EDIT: Got it working! I had just 0. and it needed to be 0.9

1 answer

Log in to vote
0
Answered by
DanzLua 2879 Moderation Voter Community Moderator
7 years ago

Hey, so if you'd like to subtract 1 from the y coordinate, all we have to do is this,

local pos = game.Players.LocalPlayer.Torso.Position-Vector3.new(0,1,0)

or you could do this

local pos = Vector3.new(game.Players.LocalPlayer.Torso.Position.X,game.Players.LocalPlayer.Torso.Position.Y-1,game.Players.LocalPlayer.Torso.Position.Z)

Hoped this helped :)

Ad

Answer this question