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

How can I position a part every 5 seconds?

I'm trying to make a part go back to its original position every 5 seconds. I've tried this:

local positionyo = -53, 5.15, 177
while true do
	wait(5)
	if script.Parent.Position == positionyo then
		break
	end
	if script.Parent.Position ~= positionyo then
		script.Parent.Position = positionyo
	end
end

The script its supposed to check if the part its first in that position so it won't run the function for nothing. I'm not too much of a scripter at all but I have a feeling I'm doing this very wrong.

2 comments

0

In this case, 'positionyo' value will be the first value stated in the line which is the '-53'

0

try using Vector3.new(positionyo) Instead of posotion yo.

1 answer

✓ Accepted answer

You would need to use Vector3 in your script. Sadly roblox cant position things with just Position = 0,0,0, you need to use Position = Vector3.new(0,0,0).

Your new script should look something like this:

local positionyo = Vector3.new(-53, 5.15, 177)--Changed it to Vector 3
while true do
    wait(5)
    if script.Parent.Position == positionyo then
        break
    end
    if script.Parent.Position ~= positionyo then
        script.Parent.Position = positionyo
    end
end

Hope this helps!

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