Hello, I made this code... but there is one problem is that it looks like it is teleporting from stud to stud, and I am trying to make it's movement smoother. But however, I don't know how to do that, Here is the code I made.
01 | while true do |
02 | wait( 3 ) |
03 | wait() |
04 | for i = 1 , 90 do |
05 | script.Parent.CFrame = CFrame.new(script.Parent.Position + Vector 3. new(. 5 , 0 , 0 )) |
06 | wait() |
07 | end |
08 | wait( 3 ) |
09 | for i = 1 , 90 do |
10 | script.Parent.CFrame = CFrame.new(script.Parent.Position - Vector 3. new(. 5 , 0 , 0 )) |
11 | wait() |
12 | end |
13 | end |
Also, the purpose of the script is to make the part move from location to location. If anyone can solve this problem, it would be appreciated.
Try :
01 | local TweenService = game:GetService( "TweenService" ) |
02 |
03 | local part = script.Parent |
04 |
05 | local tweenInfo = TweenInfo.new( |
06 | 2 , -- Time |
07 | Enum.EasingStyle.Linear, -- EasingStyle |
08 | Enum.EasingDirection.Out, -- EasingDirection |
09 | - 1 , -- RepeatCount (when less than zero the tween will loop indefinitely) |
10 | true , -- Reverses (tween will reverse once reaching it's goal) |
11 | 0 -- DelayTime |
12 | ) |
13 |
14 | local tween = TweenService:Create(part, tweenInfo, { Position = Vector 3. new( 0 , 30 , 0 ) } ) |
15 |
16 | tween:Play() |
From the wiki