Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to call value of position?

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

4 comments

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.

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.

0

Also, in the question title I accidentally typed property instead of position.

0

Simple, you just need to use Vector3.new instead Vector3 only.

1 answer

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

2 comments

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?

0

Means you have(or need) a script to change the part's position?

This discussion is preserved as it was. New answers, comments, and votes are closed.