r/robloxrooms • u/MGE_FAN-TF2 • 5h ago
Why am i doing wrong?
1
Upvotes
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 newroomend
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