How to make a door that only opens once you touch five models

ill give you more context
im making a game kinda like mario 64 or odessey and i want to make a portal that teleports you to the second world but i want it so that you have to collect all of the start to open the portal

i already made the teleport script

Can you send the teleport script and where it is located in the explorer? The best way to do this is probably to integrate the two scripts somehow but I won’t know how without the script you wrote

local telePart = script.Parent

local TeleportService = game:GetService(‘TeleportService’)

local placeID = 8996667871

local canTeleport = true

local function otherGame(otherPart)

local player = game.Players:FindFirstChild(otherPart.Parent.Name)

if player and canTeleport then

	canTeleport = false

	TeleportService:Teleport(placeID, player)

end

end

telePart.Touched:Connect(otherGame)

the script is located in the portal

idk why it only lua blocked a little bit lol

You can probably have the portal part behind the door and then when the door opens you can just walk into the portal, that is unless you want to teleport instantly

As a failsafe, you could put them in the same script and only set canTeleport as true when all 5 models are touched.

ok i dont know anything about coding lol but is it a problem that the portal is a mesh?

MeshParts behave physically the same as a Part, the only difference is that they can be given a MeshId which makes their appearance that of a 3D model (usually made in Blender). If you want to read more, it’s best to look at Roblox’s own documentation here.

tl:dr no, it doesn’t matter

ok
i did make it in blender

1 Like

Just checking, does everything work now? The door opens properly and doesn’t give any errors? Just saying because, as mentioned before, I haven’t actually tested that code myself.

one thing should i put both the teleport and the other script in the portal?

also what do i name the collectibles?

Put the teleport script under the portal and the door script in StarterCharacterScripts, alternatively you can combine them and put the singular script under StarterCharacterScripts. For simplicities sake, it’s probably easier to just do the first thing

Name the collectables TouchableModel in order to work with the script above, however you can name them whatever you want as long as you change the v.Parent.Name == ("TouchableModel") to the name of the models.

and then do i name the portal door?

What is the portal door currently called?

door

Is it parented to the workspace or under a model?

model

Ok, just change the line in the script from local Door = workspace.Door to local Door = workspace."ModelName"."DoorName"

ok i think i did it ill test it

i gotta go eat dinner and then go to my coding lessons lol ill test it latter

1 Like