#How make endless tween?
102 messages · Page 1 of 1 (latest)
Can you send example of code
Wait
Tween will be played again but he start from the start point
For example
tried setting the repeatcount to -1?
Hm. I go to try
I dont understand why, but output sayed that model dont have any position
Once ended
Make it start again
To detect when ended just use tween.Compleyed
I need an infinite one so that it moves further along X even to another universe
Ooo
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)
Try this but i dont guarantee itll work, im on mobile
Wait
Should work
Maybe
Wait
tween = newTween
unknow global tween
Show me the whole code you have rn
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)
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
You miss the global studs
Model dont move
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
Position is not valid member of model
Why model.model,
?
Edited the msg
** You are now Level 5! **
Try again
Red end
He moved. But not endless
Check output
Model have unions
Position is not a valid member of Model "Workspace.Train
Which line?
4
Can you show me the code
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)
Here
Copy this instead
Dont work
17:28:13.406 Workspace.Train.Script:6: attempt to index nil with 'GetDescendants' - Server - Script:6
Oh
Wait
On the "local UrModelHere" you need to input the model that groups the entire train
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
Dont work
Whsts the output
Nothing about this script
Twin is removed before it starts
Remove the tween:Destroy() line
Ok
Nothing happened
He launch but nothiing happened
Yes
** You are now Level 10! **
Copy the edited version and make sure tge model variable is in
Reply this code
Reply
Destroy before play
Delete the destroy part
Nothing
Then, ive got no idea, im on phone