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

Can you use the tweenService to position a part?

Asked by 7 years ago

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.

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

1 answer

Log in to vote
0
Answered by 7 years ago

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.

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. XAXA 1569 — 7y
0
Oh ok. Thank you for that. Apologies PyccknnXakep 1225 — 7y
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. beeswithstingerss 41 — 7y
Ad

Answer this question