So I am making a part move around the map and it randomly tweens to parts but instead of just going to the parts properties and putting the position in the script how would I make it so that if I change the position it will still tween to that part without me adding the new position of the part. Sorry if I didn’t explain to well
1 Like
You can use the function .Changed
so if the position changes, it wil create a new tween, and tween to that position.
1 Like
Basically just have a table of parts in different positions which are then used as reference points by the main part when tweening its own position.
local ts = game:GetService("TweenService")
local partsFolder = workspace:WaitForChild("Folder")
local parts = partsFolder:GetChildren()
local part = script.Parent
for _, aPart in ipairs(parts) do
ts:Create(part, TweenInfo.new(2), {Position = aPart.Position})
ts:Play()
ts.Completed:Wait()
task.wait(3)
end
This loop gets a folder/model of parts, iterates over each part creating a tween for the main part for each and then plays that tween, pausing for three seconds after each tween is played.
3 Likes