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

How to do a Vector3Value Calculation (-Vector3.x)?

Asked by
Moxeh 84
9 years ago

How would I make a Vector3Value = the value of another Vector3Value, but, subtracts (1) from Vector3.x ? Below is what I have tried...

while wait(1) do
    script.Parent.Parent.Value = script.Parent.Parent.Parent.Off.Value.x - 0.635
    wait(6)
end
0
Wait what? I don't understand a thing you said. EzraNehemiah_TF2 3552 — 9y
0
Basically, I want to take (100, 0, 0) in a value and subtract to make it (99, 0, 0). Moxeh 84 — 9y
0
Off.Value - Vector3.new(1,0,0) like how blue said. EzraNehemiah_TF2 3552 — 9y

1 answer

Log in to vote
1
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

It's almost always better to do math with full Vector3s rather than to do the .x, .y, etc yourself.


You want to subtract something from Off.Value. So we should be expecting something like:

Off.Value - something

something should have 1 as an x value, and it shouldn't affect y or z. blah - 0 is still blah, y and z should be 0.

Off.Value - Vector3.new( 1, 0, 0 )
Ad

Answer this question