Hello,
So I just finished creating my first self-made tween service door. But it is not working. Here is my workspace
And this is the code
local part = game.Workspace:WaitForChild('E')
local tweenService = game:GetService('TweenService')
local play = true
local info = TweenInfo.new(
1.5,
Enum.EasingStyle.Bounce,
Enum.EasingDirection.Out,
-1,
false,
0
)
local doorOpen = {CFrame = CFrame.new(-26, 3.5, 12.5)}
local closeDoor = {CFrame = CFrame.new(-22, 3.5, 12.5)}
local tweenOpen = tweenService:Create(part, info, doorOpen)
local tweenClose = tweenService:Create(part, info, closeDoor)
while play == true do
tweenOpen:Play()
wait(3)
tweenClose:Play()
end
--Before: -22, 3.5, 12.5
--After: -26, 3.5, 12.5
Move the tweenopen and tweenclose inside the while loop where you play them like so:
local part = game.Workspace:WaitForChild('E')
local tweenService = game:GetService('TweenService')
local play = true
local info = TweenInfo.new(
1.5,
Enum.EasingStyle.Bounce,
Enum.EasingDirection.Out,
0,
false,
0
)
local doorOpen = {CFrame = CFrame.new(-26, 3.5, 12.5)}
local closeDoor = {CFrame = CFrame.new(-22, 3.5, 12.5)}
while play == true do
print("open")
local tweenOpen = tweenService:Create(part, info, doorOpen)
tweenOpen:Play()
wait(3)
print("close")
local tweenClose = tweenService:Create(part, info, closeDoor)
tweenClose:Play()
wait(3)
end
--Before: -22, 3.5, 12.5
--After: -26, 3.5, 12.5
I tested it and it should be working
Edit: Also I changed the repeat count to 0 as with -1 it was looking weird because it kept repeating until the next tween was played
When repeatcount is less than 0 it keeps repeating the tween unless it is stopped or another tween is played.
RepeatCount being -1 means it will keep repeating until the next tween is played that’s why it should be 0 unless you intentionally want it to repeat.