Issue With Teleporting All Players in a Party to a Game using Party System

I’m Trying to do this small project to test my Scripting Knowledge by using a Party System Kit and editing it to teleport players to a game and need a little help.
I have a Party System but I need help teleporting Players thats in this Party to another Game
I need Help doing this I keep getting errors everytime i try

script.Parent.DeleteTeam.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.PartiesGui.DeleteTeam:InvokeServer()
end)
script.Parent.Start.MouseButton1Click:Connect(function()
	local TeleportService = game:GetService("TeleportService")
	local PlayersInParty = script.Parent.ScrollArea:GetChildren()
	for i, v in pairs(PlayersInParty) do
-- Getting the Value of The TextLabel that has the PlayersName Inside to get the name of the Player in Players to teleport them
		if v:IsA("TextLabel") then
			local Players = game.Players
			for i, v in pairs(Players) do
				game.Players[PlayersInParty][v.Text]:Teleport(6981517808,v)
			end
		end
	end
end)

this is the only part of the script I’m getting errors from.
If you need the full script you can ask me.
just re edited the script dosnt work still

script.Parent.Start.MouseButton1Click:Connect(function()
	local TeleportService = game:GetService("TeleportService")
	local PlayersInParty = script.Parent.ScrollArea:GetChildren()
	for i, v in pairs(PlayersInParty) do
		if v:IsA("TextLabel") then
			local Players = game.Players:GetChildren()
			for i, v in pairs(Players) do
				game.Players[PlayersInParty][v]:Teleport(6981517808,v)
			end
		end
	end
end)

you just forgot the :GetChildren() function, otherwise it wouldnt work.

Although, is the script a server one? is there any error in console? let us kno to help you

this was the error i gotten when i tried your script
Players.AutoGamerChadYT.PlayerGui.PartyGui.Background.PartyMenu.LocalScript:51: invalid argument #2 (string expected, got table) - Client -

but heres how the system it works

all the players in the party gets a TextLabel parented to the Scrolling Area
so im trying to get the Name of the Players from Scrolling Area in Players in game.Workspace
so that I can teleport the players

its probaly confusing because i didnt give full script

1 Like
script.Parent.Start.MouseButton1Click:Connect(function()
	local TeleportService = game:GetService("TeleportService")
	local PlayersInParty = script.Parent.ScrollArea:GetChildren()
	for i, v in pairs(PlayersInParty) do
		if v:IsA("TextLabel") then
  			local p = game.Players:FindFirstChild(v.Text)
			TeleportService:Teleport(6981517808, p)
		end
	end
end)
1 Like

no i can understand what you’re doing but please answer the questions

is the script a server one? is there any error in console?

oh crap i am so freaking dumb
the script is a local script.

i think im suppose to make a new script for it

1 Like

yes it must be a server script

also use my code :slight_smile:

1 Like

so just make a regular script and put it in server script service?
wait so im guessing i have to use remote events if its a server script in server script service
because if it dosnt stay in the GUI
then i might have to do that

1 Like

well, it depends on what you’re doing

if it is a click to teleport the players you can make it a server script and it’ll work.

although, you’ll have to replace the local player stuff, so, there you go a hint.

the starter gui’s parent’s the player,
why is that?
cuz the starter gui just clone the elements of it to the player guis and it’s parent’s the player
here you go a example

image
image

so you can replace the player variable and make it server script :slight_smile:

1 Like

the script actually worked as a local script it teleported me to the game it works
thanks dude! but ill have to test it with friends if it dosnt teleport with others then ill do server

1 Like

oka, btw

clients cant see another player gui’s children so if you’ll use remote events for something use it in the starter gui and it can’t be abused/people teleport another ones with exploits :slight_smile:

1 Like