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

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

Asked by 3 years ago

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

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

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
0
It says unable to cast a value through objects bluewell101 8 — 3y
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. radiant_Light203 1166 — 3y
0
Im trying to teleport the player to a different place bluewell101 8 — 3y
0
Then the issue is with teleporting. How are you teleporting the player? Could you show it on your question. radiant_Light203 1166 — 3y
Ad

Answer this question