Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I'm making a party system and i dont know where to start?

Okay so I'm making a party system and I want it so when the party leader gets teleported everyone else in the party gets teleported this is an rpg type game with portals that teleports you to a different place like the teleport system

I really dont know where to start how would i cast the array through all the players when theyre object values

heres the party script


game.Players.PlayerAdded:Connect(function(player)
	local PartyFolder = Instance.new("Folder",player)
	PartyFolder.Name = "Party"
	local User = Instance.new("ObjectValue",PartyFolder)
	User.Name = player.Name
	User.Value = player
	print(User.Value)
end)

1 answer

I'm sure we've all gotten stuck on something similar. The answer is to use a for i,v in pairs loop. Like so:

for i,v in pairs(PartyFolder:GetChildren()) do
	local player = v.Value
	-- do stuff to player
end

4 comments

0

It says unable to cast a value through objects

0

That doesn't make sense. What are you trying to do to the player? Are any of the folder's children not object values? Remember you're supposed to fit this to your function since this is just a way to iterate through the children of a folder.

0

Im trying to teleport the player to a different place

0

Then the issue is with teleporting. How are you teleporting the player? Could you show it on your question.

This discussion is preserved as it was. New answers, comments, and votes are closed.