-
What do you want to achieve? Keep it simple and clear!
So I saw Brackeys 's Creating your first game series and really like it. I thought wow thats cool and I never saw something like this on roblox. So lets make this… -
What is the issue? Include screenshots / videos if possible!
The problem was his game was based on levels and it would be very hard to make all the levels and players would get bored easily.
So what I thought… i thought to make a map generation system.
I followed this video. Which is in Unity cuz I couldn’t really found something I wanted in Roblox. I am a little bit familier with C#.
So now the main problem is:
The speed of ball is slow to show the generation automatic.
I can’t figure out a way to delete tiles in lua. In the video the person is using something called LIST which is in my knowledge a data structure(I am just a kid please correct me if I am wrong) not available in lua…
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried using arrays but didn’t went far with it.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
The script:
--Made by Beastcraft_Gaming--
--6/11/20--
--Variables
--Services
local Rs = game:GetService("ReplicatedStorage");
local Ws = game:GetService("Workspace");
--instances
local player = Ws:WaitForChild("player");
local Tiles = Rs:WaitForChild("Tiles"):GetChildren();
local TilesFolder = Instance.new("Folder", Ws); TilesFolder.Name = "TilesFolder"
--Values
local zSpawn : number = 0;
local TileLength = -100;
local numberOfTiles = 1;
--functions
local function SpawnTile(tileIndex : number)
local tile = Tiles[tileIndex]:Clone();
tile.Parent = TilesFolder;
tile:SetPrimaryPartCFrame(CFrame.new( Vector3.new(0,-10,0 + zSpawn)) * CFrame.Angles(0,math.rad(90),0));
zSpawn += TileLength;
print(zSpawn);
end
local function Main()
for i = 1, numberOfTiles, 1 do
if i == 1 then
SpawnTile(1);
else
local RandNum = math.random(1,#Tiles);
SpawnTile(RandNum);
end
end
end
local function Update()
if player.position.z < zSpawn - (numberOfTiles*TileLength)then
print("Yes");
local RandNum = math.random(1,#Tiles);
SpawnTile(RandNum);
end
end
--Main
local thread = coroutine.wrap(function()
while true do
Update();
wait(0.1);
end
end)
thread();
Main();
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.