How to make an infinite ocean

i want to create an infinite ocean
i have a skinned mesh ocean its 3x3 grid of them (each part is 2046 by 2046) i also have a 5x5 one if its needed
i tried checking which part is closer to the player and moving the ocean like that but it didnt work
if you know another way to make an infinite ocean or fix mine help is appreciated.

local currentWave = nil
local oldWave = nil
local Waves = workspace:WaitForChild("Waves")

while true do
	task.wait(5)
	
	for i, v in pairs(Waves:GetChildren()) do
		if currentWave then
			if v.Position > currentWave.Position then
				oldWave = currentWave
				currentWave = v
			else
				oldWave = currentWave
				currentWave = v
			end
		end
	end
	
	if currentWave ~= oldWave then
		Waves:PivotTo(currentWave.Position)
	end
end
1 Like

Keep a table of which tiles are loaded. Anytime the player moves, check if they are now in a new tile. If they are, re-calculate which tiles should be loaded (e.g. 10 tiles in each direction). Compare those tiles to the ones in your loaded tiles table to determine which ones to load and unload.

I have a game that does something similar you can check out: UNL Demo Place - Roblox.
Look in ServerScriptService.Terrain.TerrainGenerator

idk why but when i click edit in studio on the game studio doesnt open and its like that for every game can you send a file of the game or the script?

You have a problem with how magnet links are handled in your browser. Let me see if theres another way to get to it.

i made it work but only locally

local currentWave = nil
local Waves = workspace:WaitForChild("Waves")
local player = game.Players.LocalPlayer
local character = player.Character

while true do
	task.wait(5)

	for i, v in pairs(Waves:GetChildren()) do
		if v:IsA("MeshPart") then
			if currentWave then
				if (character.PrimaryPart.Position - v.Position).magnitude < (currentWave.Position - character.PrimaryPart.Position).magnitude then
					currentWave = v
				end
			else
				currentWave = v
			end
		end
	end
	
	Waves:PivotTo(currentWave:GetPivot())
end

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.