I am working on a tycoon and I am trying to get a bit “advanced” with some features, but am hitting roadblock in my knowledge…
I am looking to use Roblox terrain, not a voxel or brick made terrain.
What do you want to achieve?
I want to load specific terrain designs based on user selections (i.e. the user has three options to choose from, whichever design option they choose, that terrain loads.)
What is the issue?
You cannot create “models” with terrain, so all terrain is ‘one’ on the map. Also am not sure how to show/hide terrain based on a user’s interaction with a button.
What solutions have you thought of so far?
-cricket noises-
I am looking into creating the terrain in a far, far away location from the map - with a script that would copy the terrain in that location then paste it into the designated area of the tycoon.
Can someone please help me understand why the script I wrote does not work? (noob to luau)
Code
local clickDetector = script.Parent.ClickDetector
local fromMins = Region3.new(-26.775, -2.575, -60.225)
local fromMaxs = Region3.new(-6.25, 19.075, -38.525)
local toMins = Region3.new(-26.775, 32.225, -15.675)
local toMaxs = Region3.new(-6.125, 53.875, 6.025)
local TycoonOptionA = Region3.new(fromMins, fromMaxs)
local Destination = Region3.new(toMins, toMaxs)
local function copyTerrain()
local clipboard = game:GetService("Workspace"):FindFirstChild("TerrainClipboard")
if not clipboard then
clipboard = Instance.new("Terrain", game:GetService("Workspace"))
end
clipboard:CopyRegion(TycoonOptionA)
end
local function pasteTerrain()
local clipboard = game:GetService("Workspace"):FindFirstChild("TerrainClipboard")
if clipboard then
clipboard:PasteRegion(Destination)
end
end
local function onPartClick(player)
copyTerrain()
pasteTerrain()
end
clickDetector.MouseClick:Connect(onPartClick)