Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Unable to cast Instance to CoordinateFrame?

Asked by 2 years ago

Now, I am trying to make a Roblox doors fangame, and I am following this mans tutorial. youtube.com/watch?v=z0g5sLZapqI&ab_channel=GnomeCode But when it comes time to test, it says unable to cast Instance to CoordinateFrame. Here is the code from my script (The one called server) local room = require(script.Room)

local prevRoom = workspace.SpawnRoom room.Generate(prevRoom)

And here is the code from my module script (The one called room) local room = {} room.random = Random.new()

function room.Generate(prevRoom) local possibleRooms = workspace.Rooms:GetChildren() local randomRoom = possibleRooms[room.random:NextInteger(1, #possibleRooms)] local newRoom = randomRoom:Clone()

newRoom.PrimaryPart = newRoom.Entrance newRoom:PivotTo(prevRoom.Exit.CFrame)

newRoom.Parent = workspace.GeneratedRooms

return newRoom

end

return room

Keeping in mind that i am new to Roblox studio, and have very little knowledge on the program. Help would be amazing.

0
please put your code in a code block theking66hayday 841 — 2y

Answer this question