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

How do I change a Vector3 Value??

Asked by 10 years ago

(only first 8 lines) c = game.Players:GetChildren() x,y,z = script.TargetPosition.Value.X ,script.TargetPosition.Value.Y, script.TargetPosition.Value.Z while wait() do for i = 1, #c do local points = ``game.ReplicatedStorage.RemoteFunction:InvokeServer(c[i].Character.Torso.Position) x,y,z = points.X, points.Y, points.Z

it doesn't change the value

0
Edit your post and use the other code formatting (the Lua button) please! BlueTaslem 18071 — 10y

1 answer

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

To make a Vector3 from three coordinates, you use Vector3.new(x, y, z).

For example,

Brick.Position = Vector3.new( vec.X, vec.Y, vec.Z )

However this is redundant. There's no need to construct a value when you already have one:

Brick.Position = vec

Rarely is it that you will need to deconstruct a Vector3 into its coordinates; it's just unnecessary. Using it as a single Vector3 is less typing, faster, and easier.


I don't really understand what it is you are trying to do here, so I can't give any more specific advice.


I also see you are using a remote function you've just named RemoteFunction. That's a useless name -- it should describe what it does so that your code is more explanatory and descriptive.

Ad

Answer this question