#How make endless tween?

102 messages · Page 1 of 1 (latest)

spice fiber
#

To move on X

#

What?

#

I dont understand you

peak roost
#

tween.Completed

#

^ event

#

Then play tween again

spice fiber
peak roost
#

Not on pc

#

Ask bing ai, he can give example

spice fiber
#

Tween will be played again but he start from the start point

#

For example

reef perch
#

tried setting the repeatcount to -1?

spice fiber
spice fiber
peak roost
#

Make it start again

#

To detect when ended just use tween.Compleyed

spice fiber
peak roost
#

Ooo

worldly kestrel
#

Try this but i dont guarantee itll work, im on mobile

#

Wait

#

Should work

#

Maybe

spice fiber
#

tween = newTween

#

unknow global tween

worldly kestrel
#

Show me the whole code you have rn

spice fiber
#
local TweenService = game:GetService("TweenService")
local UrPartHere = script.Parent
local UrInfoHere = TweenInfo.new(5)

local studs = 10

tween.Completed:Connect(function()
    local newTween  = TweenService:Create(UrPartHere, UrInfoHere, {Position = UrPartHere.Position + Vector3.new(studs,0,0)})
    tween = newTween
    tween:Play()
end)
worldly kestrel
#
local TweenService = game:GetService("TweenService")
local UrPartHere = script.Parent
local UrInfoHere = TweenInfo.new(5)
local tween = TweenService:Create(UrPartHere, UrInfoHere, {Position = UrPartHere.Position + Vector3.new(10,0,0)})

local studs = 10

tween:Play()

tween.Completed:Connect(function()
    local newTween  = TweenService:Create(UrPartHere, UrInfoHere, {Position = UrPartHere.Position + Vector3.new(studs,0,0)})
    tween = newTween
    tween:Play()
end)
#

Wait

#

Should work

worldly kestrel
#

Edited

#

Try now

spice fiber
#

Model dont move

worldly kestrel
#

Oooh you meant for the whole model instead of part

#
local TweenService = game:GetService("TweenService")
local UrModelHere --create the variable for your model
local UrInfoHere = TweenInfo.new(5)
local studs = 10 --change it to however you like

for _,part in pairs(UrModelHere:GetDescendants()) do
if part:IsA("Part") or part:IsA("UnionOperation") then
local tween = TweenService:Create(part, UrInfoHere, {Position = part.Position + Vector3.new(studs,0,0)})

tween:Play()

tween.Completed:Connect(function()
local newTween = TweenService:Create(part, UrInfoHere, {Position = part.Position + Vector3.new(studs,0,0)})
newTween:Play()
tween = newTween
end)
end
end
spice fiber
#

Why model.model,

#

?

worldly kestrel
#

Edited the msg

vagrant mantleBOT
#

studio** You are now Level 5! **studio

worldly kestrel
#

Try again

spice fiber
spice fiber
worldly kestrel
#

Should be corrected

#

Try again

#

Mobile scripting

spice fiber
worldly kestrel
#

Check output

spice fiber
#

And my model went from this to this

worldly kestrel
#

It has unions too?

#

And/or meshes?

spice fiber
worldly kestrel
#

Edited

#

Try again

spice fiber
worldly kestrel
#

Which line?

spice fiber
worldly kestrel
#

Can you show me the code

spice fiber
#

Sure

#
local TweenService = game:GetService("TweenService")
local UrPartHere = script.Parent
local UrInfoHere = TweenInfo.new(5)
local tween = TweenService:Create(UrPartHere, UrInfoHere, {Position = UrPartHere.Position + Vector3.new(10,0,0)})

local studs = 10

tween:Play()

tween.Completed:Connect(function()
    local newTween  = TweenService:Create(UrPartHere, UrInfoHere, {Position = UrPartHere.Position + Vector3.new(studs,0,0)})
    tween = newTween
    tween:Play()
end)
spice fiber
spice fiber
#

17:28:13.406 Workspace.Train.Script:6: attempt to index nil with 'GetDescendants' - Server - Script:6

#

Oh

#

Wait

worldly kestrel
#

On the "local UrModelHere" you need to input the model that groups the entire train

spice fiber
#

Worked

#

But

#

Not endless

#

I go to dinner

#

Im back 15 minutes

worldly kestrel
#
local TweenService = game:GetService("TweenService")
local waittime = 5
local UrModelHere --create the variable for your model
local UrInfoHere = TweenInfo.new(waittime, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut)
local studs = 10 --change it to however you like

for _,part in pairs(UrModelHere:GetDescendants()) do
if part:IsA("Part") or part:IsA("UnionOperation") then
while task.wait() do
local tween = TweenService:Create(part, UrInfoHere, {Position = part.Position + Vector3.new(studs,0,0)})
tween:Play()
wait(waittime)
tween:Destroy()
end
end
end
worldly kestrel
#

Whsts the output

spice fiber
spice fiber
spice fiber
worldly kestrel
#

Remove the tween:Destroy() line

spice fiber
#

Ok

spice fiber
#

He launch but nothiing happened

worldly kestrel
#

Hmmm

#

Edited

#

Btw did u put the variable of ur model in it?

vagrant mantleBOT
#

studio** You are now Level 10! **studio

worldly kestrel
#

Copy the edited version and make sure tge model variable is in

spice fiber
#

Wait i add print for check

spice fiber
worldly kestrel
#

Delete the destroy part

spice fiber
worldly kestrel
#

Then, ive got no idea, im on phone