r/robloxrooms • u/MGE_FAN-TF2 • 10d ago
Why am i doing wrong?
Tutorial i follow:https://www.youtube.com/watch?v=AbUJd5cvuPE&list=PLPTEPcIhVuC67HZKp_S_7zoZE9qFdFYuB&index=2
Code 1:
local room = {}
room.random = Random.new()
function room.generate(prevroom: Model, int: number)
local potential = game.ServerStorage:GetChildren()
lolcal newroom = potential\[room.random:NextInteger(1, potential)\]:Clone()
newroom:pivotTo(prevroom.exit.cframe)
workspace.LatestRoom.Value = newroom
newroom.Parent = workspace.generatedrooms
return newroom
end
return room
Code 2:
local room = require(script:WaitForChild("room"))
local generate = game.ServerStorage.bindableEvents:WaitForChild("Generate")
local prevroom = workspace.lobby
generate.Event:Connect(function()
prevroom = room.generate(prevroom)
end)
for i = 1, 5 do
generate:fire()
end
2
Upvotes
1
u/cool101wool 9d ago
hi
can you attach images of the full code and where it is inside of explorer (or a place file with just the bare minimum that contains whats going on that shouldn't be and nothing else) so its easier to see