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

How to call value of position?

Asked by
B_Iu 31
6 years ago
Edited 6 years ago

I've made a script that is supposed to identify the brick's position, and I don't know how to make it work properly. Here's what I have come up with so far.

tim = 0
while wait(1) do
    if script.parent.Value.Value == Vector3(0, 0, 0) then
        print("done, it took ".. tim .." seconds")
    else
    tim = tim + 1
    end
end
0
You have a typo. It should be `script.Parent` ~ but what is `script.Parent` ? You describe "the brick's" position but seem to be indexing a ValueObject's `Value` Property. Goulstem 8144 — 6y
0
The script is in the block. Also, there is a vector3 value I inserted into the block, then added another script to update that value. Also, I know I always type parent without a capital, It works either way, so it has just become a habit of mine. B_Iu 31 — 6y
0
Also, in the question title I accidentally typed property instead of position. B_Iu 31 — 6y
0
Simple, you just need to use Vector3.new instead Vector3 only. monchaso 0 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
while true do
    script.Parent.Value.Value = script.Parent.Position
    wait(0.01)
end

That's the script to update the value, but i don't think you really need that,to update the value you need a loop and this loop runs 100 times in a second, So why you hadn't just used if script.Parent.Position == Vector3.new(0, 0, 0) then in line 3?

here is the thing you can do with your script :

local tim = 0
while wait(1) do
    if script.Parent.Position == Vector3.new(0, 0, 0) then
        print("done, it took ".. tim .." seconds")
    else
        tim = tim + 1
    end
end
0
Okay, so when I use the script, It still doesn't work. I figured out why. When the position is 0, 0, 0, it stays at 0, 0.1, 0 for some odd reason... The script updating the position isn't disabled or anything. Any ideas? B_Iu 31 — 6y
0
Means you have(or need) a script to change the part's position? TheSkyofIndia 150 — 6y
Ad

Answer this question