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

Character Customization Spawn/Teleport to Room for Players?

Asked by 3 years ago

I have made a character customization and a room for the player to teleport, to customize there character, what I want to know is how i would have a room for each player so its not the one room the players teleport in to customize there character. I have tried just simply using a local script that makes others invisible to the player when in the room but it has faults and makes all players invisible. info: the player teleports to a room the room has a part that the player teleports to and his movement is disabled and the camera switches to a part facing the room. needed: a room for each player to teleport or a way that makes the players not in the one room when customizing there character. ANY HELP IS NEEDED THANK YOU!

1 answer

Log in to vote
0
Answered by 3 years ago

There's probably a better solution than what you're suggesting (or what I used), but we can make it work.

You can have a grid of room models built and a 2d array to represent the room and the vacancy of those rooms.

Every time a player wishes to teleport to a room, your script will iterate through a for each loop and will return the first room that is vacant. From there, you can teleport the player

May look something like this.

rooms = { -- initialize and define rooms array
{workspace.Room1.TeleportPart, false},
{workspace.Room2.TeleportPart, false},
{workspace.Room3.TeleportPart, false},
{workspace.Room4.TeleportPart, false},
{workspace.Room5.TeleportPart, false}} -- sparse is better than dense!

function Teleport()
    for i, room in pairs(rooms) do -- loop through rooms
        if not room[2] then -- if the room isn't vacant
            -- teleport stuff here
        end
    end
end

Sorry if I made any code mistakes, have been doing java and c++ for awhile.

Ad

Answer this question