local function generate(Startingposition, MaxRooms)
local function nextbuilding()
local waypoint = game.Workspace.buildings:FindFirstChild("waypoint", true)
if waypoint.Name == "waypoint" then
local NewPosition = waypoint.Position + waypoint.CFrame.LookVector * 50
print(waypoint.CFrame.LookVector)
local funnyNumber = math.random(1,1)
if funnyNumber == 1 then
local Buildings = ReplicatedStorage.assets:WaitForChild("straight")
local Buildinglist = Buildings:GetChildren()
local Building = Buildinglist[math.random(1, #Buildinglist)]:Clone()
Building.Parent = game.Workspace.buildings
local cf = CFrame.new(Vector3.new(NewPosition.X, Startingposition.Y, NewPosition.Z), waypoint.Position)
Building:SetPrimaryPartCFrame(cf)
cf = CFrame.new(Building.PrimaryPart.Position) * CFrame.Angles(math.rad(0), math.rad(Building.PrimaryPart.Orientation.Y), math.rad(Building.PrimaryPart.Orientation.Z))
Building:SetPrimaryPartCFrame(cf)
elseif funnyNumber == 2 then
local Buildings = ReplicatedStorage.assets:WaitForChild("turn")
local Buildinglist = Buildings:GetChildren()
local Building = Buildinglist[math.random(1, #Buildinglist)]:Clone()
Building.Parent = game.Workspace.buildings
end
end
end
(its not putting it in the correct spot)
#how do i fix this?
1 messages · Page 1 of 1 (latest)
sorry
yeah (im waiting for ANYTHING because this would ACTUALLY fix EVERY problem)
** You are now Level 2! **
[ANYTHING:](#1402591607689314415 message)
no
thats not what i need
😭
i tried
(aka this is my attempt)
but it just doesnt work
for some reason
so there's no bug to fix, you simply haven't finished it
because for there to be something broken about it, it must be working at least partially.
else it is an unfinished work in progress, or it is garbage
it's like saying a car has been totalled or written off - that's past the point of something you can fix.
damaged, can be fixed too
a car on an assembly line, you wouldn't say it needs to be "fixed" before it can be rolled off the assembly line.
you'd say it is unfinished
so what is your attempt?
is it a work in progress, is it damaged, or is it ruined beyond repair?
wip but i dont know what to do (it works rn after adding 1 line) but just doesnt put it in right position
and i DO NOT KNOW how to fix it
[use vectors for placement](#1402591607689314415 message)
also why do you have this if statement? lua local waypoint = game.Workspace.buildings:FindFirstChild("waypoint", true) if waypoint.Name == "waypoint" then
isn't it, like, literally impossible for this if statement to ever be false, except for when there is no instance named waypoint found and thus it would error on attempt to index nil with 'Name'?
and i mean if the position is wrong... well i mean just look at your code. you only really have exactly one position. local NewPosition = waypoint.Position + waypoint.CFrame.LookVector * 50
[i wasn't joking when i said you need to do more research. you are trying to do something that you're not ready for. if you really insist, google it. if you aren't studying anything and everything you find on google, and you are instead just sitting here twiddling your thumbs waiting for someone to come along and take possibly hours if not days of their time to personally tutor you and teach you every little thing you need to know, you are not going to get far.](#1402591607689314415 message)
that's all without mentioning with your thread here you've just thrown code and ask "how fix", literally. how is anyone supposed to work with that. fix what? what's wrong with it? but i think i've already made the point that you aren't ready to make something like this yet. start with something simpler like... generate parts in a grid, which is what google is telling you to do and has tonnes of tutorials for it. if you can't do that, you sure as hell aint doing any kind of procedural generation more than what you currently have.