Help Improving Boat Wake System

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.
bandicam 2020-05-13 20-46-14-972

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.

4 Likes

I know this is probably too simple of an answer, but couldn’t you just use a particle emitter?

1 Like

Have you explored using trails instead of parts? Trails seem to fit your use case much better.

2 Likes

I thought that was a great idea too but I tried that, and it didn’t work because the particles would always be facing the camera.

Trails would be of good use however the ship is stationary whereas trails need be in motion in order for them too apear.

Ah, gotcha. What about a beam then? You can scroll the texture of the beam to give the illusion of movement.

You can even make the beam wider towards the end so that it looks like the wake is expanding.

5 Likes

This seems like a great solution since beams already have the scrolling future that is meant to be used just like this.

1 Like

Ah… great idea, let me try that! I’ll reply when I’m finished.

And also you can make the beam more Transparent the farther away it is so it seems to fade away.

2 Likes

If the ship is stationary, the best solution is to use beams. If it’s moving, trails would be a better choice. Then the issue with gaps or multiple textures on top of each other shouldn’t happen.

2 Likes

Thank you to everyone who contributed to this topic @ExcessEnergy @XAXA @Scottifly and Dziękuję Ci @CaptainMarcin.

“The problem is that we attempt to solve the simplest questions cleverly, thereby rendering them unusually complex. One should seek the simple solution.” - Anton Chekhov

With the beam, I was able to create the wake perfectly. I’ll probably add waves to the ship with the beams as well.

1 Like

I actually used a series of transparent rolling cylinders with semi transparent white ‘wave’ decals at the front of my aircraft carrier which was built a few years ago and they worked fairly well.
Have a look here: USS Bunker Hill with Corsairs - Roblox
I think I used particles for the wake, been a while and can’t remember!

1 Like