there is only 2 reasons i’m aware of that will prevent a script from running
- it does not have the correct Parent
- its disabled
other then them 2 reasons i have never seen a script not run
there is only 2 reasons i’m aware of that will prevent a script from running
other then them 2 reasons i have never seen a script not run
My script has the right parent and is not disabled. Is there any other way?
Can you send me a screenshot of where the script is and the scripts properties?
Ok here is a screenshot of those:
The rest of the stuff in Workspace are for something else.
And if you delete everything inside the script and only have
print("Hello World")
Can you see it print that in the output window?
It printed out Hello World! in the output. So that works.
ok grate now we no the script is running
now lets change the script to
print("SCRIPT STARTING")
local seed = nil -- if the seed is nil then it will be a random seed
local rand = Random.new(seed)
local chunks = game.ReplicatedStorage.Generation:GetChildren()
local chunkSpacing = 11
print("Found", #chunks, "Chunks")
for x = -10, 10 do
for z = -10, 10 do
print("Loading Chunk", x, z)
-- select a random chunk model
local i = rand:NextInteger(1, #chunks)
-- clone the random chunk
local clone = chunks[i]:Clone()
-- position the clone chunk
clone:PivotTo(CFrame.new(x * chunkSpacing, 0, z * chunkSpacing))
-- parent the clone
clone.Parent = workspace
end
end
and lets see what it prints
It only printed SCRIPT STARTING.
are there any errors after it prints script started?
Now I see a error.
Here it is:
11:51:29.196 Workspace.MapGenerationSystem:3: invalid argument #1 to ‘new’ (number expected, got nil) - Server -
that’s strange if we do
print("SCRIPT STARTING")
local rand = Random.new()
local chunks = game.ReplicatedStorage.Generation:GetChildren()
local chunkSpacing = 11
print("Found", #chunks, "Chunks")
for x = -10, 10 do
for z = -10, 10 do
print("Loading Chunk", x, z)
-- select a random chunk model
local i = rand:NextInteger(1, #chunks)
-- clone the random chunk
local clone = chunks[i]:Clone()
-- position the clone chunk
clone:PivotTo(CFrame.new(x * chunkSpacing, 0, z * chunkSpacing))
-- parent the clone
clone.Parent = workspace
end
end
does that still error?
Does seem to work, but it is very buggy and it decides to lag the place file.
What I mean by buggy is that it spawns plots inside each other of what I can see because of the lag.
Edit: Here is a screenshot of what the file looks like when it is run:
so currently the script is spawning 20 by 20 (20x20 = 400) models with 11 studs of spacing apart
so if any plots are smaller or bigger then 11 studs it will overlap
You’re not allowed to blatantly just ask for a script. Show us code you’ve tried, and we will improve from it.
Here is my recommendation
make it simple
so lets have a chunk which can be any size “example: 50 studs per chunk”
create some 50 studs chunk placed side by side
then make a area by hand “example: city, forest, hills” which are randomized
top chunks are city, bottom chunks are city, middle chunks are forest
then make sure the the parts that you gonna parent to the chunks are optimized for this method or else it won’t look good “not seamless”
it could take 4 or 2 days to make one for an average scripter, a complex version much longer
– good luck with your map generation system
Is it possible that I can have it bigger than 11 studs and it won’t overlap?
yes its possible just change 11 to any number you want
Does seem to work! Thank you for helping out