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

Can you use the tweenService to position a part?

I am trying to slide a part using TweenService. The line of code that I am having trouble with is this: local Goals = {Position = Vector3.new(-2113.106, 61.693, 2941.344)} and I came up with this error: attempt to call global 'Vector3'(a table value). Are you not allowed to use Vector3.new when it comes to positions and TweenService? I would appreciate if you could help me with my struggles.

1 comment

0

Tweening is just for GUIs. For parts there is a similar technique called Lerping: http://wiki.roblox.com/index.php?title=Lerp

1 answer

Here is a script that I used to make 4 parts slide upwards smoothly:

local door1 = game.Workspace.door1
local door2 = game.Workspace.door2
local door1_1 = door1:WaitForChild('door1')
local door1_2 = door1:WaitForChild('door2')
local door2_1 = door2:WaitForChild('door1')
local door2_2 = door2:WaitForChild('door2')
for i = 1, 20 do
				door1_1.CFrame = CFrame.new(door1_1.Position + Vector3.new(0, 0.5, 0))
				door1_2.CFrame = CFrame.new(door1_2.Position + Vector3.new(0, 0.5, 0))
				door2_1.CFrame = CFrame.new(door2_1.Position + Vector3.new(0, 0.5, 0))
				door2_2.CFrame = CFrame.new(door2_2.Position + Vector3.new(0, 0.5, 0))
				wait()
			end

I don't think you can use Tweening for parts. Also, I don't think a Vector3 value is allowed in a table, just like the error says.

3 comments

0

You can use TweenService for parts. You can tween almost any instance, provided that the property you're trying to tween is tweenable. The error might be from the way s/he's using TweenService.

0

Oh ok. Thank you for that. Apologies

0

What would I use to replace vector3 in that case to move a part in my script? I saw someone tweet a post where they moved a part using tween and like Pyccknn did. I just would like it as smooth as I can get it.

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