Basically, the script works but sometimes the part overlaps on each other making it lock neat. Every now and then the entire system will just stop working as well.
Here is a video of the current system:
If the video doesn’t work here are some screenshots of where the script isn’t as optimized.
There are two scripts in ServerScriptService.
Script 1
while true do
local TweenService = game:GetService("TweenService")
local part = Instance.new("Part")
part.Position = Vector3.new(0, 0, -516)
part.Size = Vector3.new(187, 1, 1230)
part.Orientation = Vector3.new(0, -90, 0)
part.Anchored = false
part.Transparency = 1
part.CanCollide = false
part.Name = "WAVE1"
part.Parent = game.Workspace
local decal = Instance.new("Decal", part)
decal.Face = 1
decal.Texture = "http://www.roblox.com/asset/?id=5029095266" -- This is the wake
local goal = {}
goal.Position = Vector3.new(2210, -0.5, -516)
local tweenInfo = TweenInfo.new(
22,
Enum.EasingStyle.Linear,
Enum.EasingDirection.InOut,
-1,
false,
0
)
local tween = TweenService:Create(part, tweenInfo, goal)
tween:Play()
tween.Completed:Wait() -- waits until the tween is completed
part:Destroy() -- Destroy the part after it has reached the desired location
end
Script 2
wait(9.5) -- Wait until the other part has already spawned
while true do
local TweenService = game:GetService("TweenService")
local part = Instance.new("Part")
part.Position = Vector3.new(0, 0, -516)
part.Size = Vector3.new(187, 1, 1230)
part.Orientation = Vector3.new(0, -90, 0)
part.Anchored = false
part.Transparency = 1
part.CanCollide = false
part.Name = "WAVE2"
part.Parent = game.Workspace
local decal = Instance.new("Decal", part)
decal.Face = 1
decal.Texture = "http://www.roblox.com/asset/?id=5029095266"
local goal = {}
goal.Position = Vector3.new(2210, -0.5, -516)
local tweenInfo = TweenInfo.new(
22,
Enum.EasingStyle.Linear,
Enum.EasingDirection.InOut,
-1,
false,
0
)
local tween = TweenService:Create(part, tweenInfo, goal)
tween:Play()
tween.Completed:Wait() -- waits until the tween is completed
part:Destroy() -- Destroy the part after it has reached the desired location
end
I know that this is the best practice to wait at the beginning of the script as the script timings could vary. If there is anything that could improve this script or make it so that way it doesn’t look like the parts overlapped please let me know. Thank you!
Note: The ship is stationary. It uses the script to create the illusion that it is moving.