I created a tween where a lava block would go up and down repetitively, but when I go directly under the block (which is where a semi-transparent ending block is) the tween stops playing for some reason. Is the .Touched event causing this?
Can you send the script so I can have a look?
local TS = game:GetService("TweenService")
local info = TweenInfo.new(1.2, Enum.EasingStyle.Circular, Enum.EasingDirection.In, 0, true, 0)
local ender = {
["Position"]=script.Parent.Parent.Transparent.Trans2.Position
}
local tween = TS:Create(script.Parent, info, ender)
while wait(2.4) do
tween:Play()
end
you only created one tween so it will only play once
local TS = game:GetService("TweenService")
local info = TweenInfo.new(1.2, Enum.EasingStyle.Circular, Enum.EasingDirection.In, 0, true, 0)
local ender = {
["Position"]=script.Parent.Parent.Transparent.Trans2.Position
}
while wait(2.4) do
local tween = TS:Create(script.Parent, info, ender)
tween:Play()
end
It says while wait(2.4) do
meaning that it will continuously play, waiting 2.4 seconds each loop. (the time taken for the whole entire animation to play)
one tween can only play once so you have to create a new tween in every loop
Do this if you want it to loop continuously
while true do
local tween = TS:Create(script.Parent, info, ender)
tween:Play()
tween.Completed:Wait()
end
I’m pretty sure the tween can be run more than once, because it acts like a function. It loops for me. The problem is that it somehow stops for a few seconds when the player is under it.
is cancollide on for the part and is it anchored
or try tweening the cframe
The part is Anchored, CanCollide False
local TS = game:GetService("TweenService")
local info = TweenInfo.new(1.2, Enum.EasingStyle.Circular, Enum.EasingDirection.In, 0, true, 0)
local ender = {
["Position"]=script.Parent.Parent.Transparent.Trans2.Position
}
local tween = TS:Create(script.Parent, info, ender)
while wait(2.4) do
tween:Play()
tween.Completed:Wait()
break
end
If the part remaining in the same place and only traveling along the y-axis then you can create two tweens and play them after each other in a loop. Something like this:
local TS = game:GetService("TweenService")
local info = TweenInfo.new(1.2, Enum.EasingStyle.Circular, Enum.EasingDirection.In, 0, true, 0)
local part = script.Parent
local upTween = TS:Create(part, info, {Position = part.Position})
local downTween = TS:Create(part, info, {Position = script.Parent.Parent.Transparent.Trans2.Position})
while true do
upTween:Play()
upTween.Completed:Wait()
downTween:Play()
downTween.Completed:Wait()
end
Note: I don’t know which position is supposed to be going up and which is down, so you may need to change the order the tweens play.