So I’m trying to make it so I only teleport people that are in the folder ‘InRound’. They are saved as there player name in a string Value. So take me for example my roblox name is TheDCraft and if I was put into that folder I would be a string Value called ‘TheDCraft’ so I’m trying to make it so only people in that folder can be teleported to the game.
I thought I might be on to something in the comment not sure if that’s well executed. Please help. Also the the two lines after Local Function Teleport() is the map name and the I want them to teleport on a random part of the map. So when they teleport there it’s random.
The thing thats wrong in that code is you doing player.Character when player is a string value, for that you do game.Players:FindFirstChild(player.Name) to know the player,
Another thing is doing game.Players:GetChildren().Name , this wont work basically because game.Players:GetChildren() returns a table with the children names, also you should do :GetPlayers() instead of GetChildren so you could do another thing which would be:
if table.find(game.Players:GetPlayers(), player)
the rest of the code will work fine.
Is this CFrame teleportation or place teleportation?
If place then use:
||This function teleports a group of
Players to the same server instance in the given place. It returns the
DataModel.JobId of the server instance the players were teleported to.
||This function teleports one or more
Players to a reserved server created using
TeleportService:ReserveServer. The reservedServerAccessCode parameter is the access code returned by
ReserveServer TeleportToPrivateServer can only be called on the server.
GetChildren() in the folder and find these children in workspace. Then set the CFrame
No. You should know what is a character and how to use CFrame, player finding. But anyways.
You can get the character for doing game.Players:FindFirstChild(player.Name).Character.
(But seriously you should learn how to use the Player service)
Let me look into CFrame and player finding. I’ve only been scripting for a couple of days. Thanks
This will never teleport a player because the data inside the InRound folder is a string value and doesn’t hold any of a players characteristics like HumanoidRootPart.
Why not just parent the character to this folder then and add a whitelist for getChildren()
To be honest I’m not that good at scripting. Only been doing it for a couple days. So I’m not sure how to parent the character to the folder and whitelist. I need to do more research into roblox lua.
Just put a script into StarterCharacterScripts and FireClient and set
char = script.Parent
char.Parent = FolderName
The thing is I have a afk system which deletes the player that has it enabled from the inRounds folder. Would this mess it up?
Most likely it will if you are removing the player’s character
This system is the one that creates the players name in the folder and deletes it aswell.
Why are you removing the character in the first place?
If the player is afk they’re not in the folder, and if they do get put in the folder and go afk then they will get deleted before the game starts.
Just reset the players parent back to workspace then and don’t remove them
I did this and It seems to work