Forum > General >

[HELP] How do I add multiple players to this script?

CJ99

CJ$

Posts: 187

Threads: 48

Joined: Sep, 2021

Reputation: -6

Posted

Here's a script I use to assign a person to a certain team in rblx studio, however, I want to assign multiple people. Adding a comma and their name doesn't work for some reason...

local Owner = game.Teams.Staff

game.Players.PlayerAdded:Connect(function(player)
    if player.Name == "EstabMort" then
        player.Team = Owner
      end
end)
--How do I add multiple people in the player.Name so multiple people can be automatically assigned to the team?
  • 0

https://gyazo.com/9e36f19dea3a77fbcdc641f0276c4cd8

 

"I'll have two number 9s, a number 9 large, a number 6 with extra dip, a number 7, two number 45s, one with cheese, and a large soda."

Syraxes_

Web Developer

vip

Posts: 1069

Threads: 30

Joined: Jul, 2021

Reputation: 63

Replied

Shh, I'm not sure I can do that from a localscript.

  • 0

I'm not lazy, I'm just highly motivated to do nothing. #I💚Dogs.

CJ99

CJ$

Posts: 187

Threads: 48

Joined: Sep, 2021

Reputation: -6

Replied

@68837It's not an exploit script It's for my game that I can edit w/ rblx studio

  • 0

https://gyazo.com/9e36f19dea3a77fbcdc641f0276c4cd8

 

"I'll have two number 9s, a number 9 large, a number 6 with extra dip, a number 7, two number 45s, one with cheese, and a large soda."

Posts: 177

Threads: 19

Joined: Jul, 2021

Reputation: 6

Replied

local Owner = game.Teams.Staff
local users = {"user1", "user2", "user3"} --change users to your liking delete them or add them

game.Players.PlayerAdded:Connect(function(player)
    if player.Name == users then
        player.Team = Owner
      end
end)


--idk i dont code in lua
  • 0

10 years ago

Syraxes_

Web Developer

vip

Posts: 1069

Threads: 30

Joined: Jul, 2021

Reputation: 63

Replied

@CJ99

 

I think you need to use a remote event.

  • 0

I'm not lazy, I'm just highly motivated to do nothing. #I💚Dogs.

Posts: 159

Threads: 32

Joined: Feb, 2021

Reputation: 9

Replied

simple.

local owners = {
"EstabMort", "TheJ"
}
local Owner = game.Teams.Staff
game.Players.PlayerAdded.Connect(function(player)
for i, v in pairs(owner) do
if player.Name == owner then
player.Team = Owner
end
end
end)
  • 0

Added

@child1010
just so you know, in your script you're comparing a player instance to a table

  • 0

hookfunction

fake wumat

vip

Posts: 119

Threads: 15

Joined: Aug, 2021

Reputation: 18

Replied

local Staff = {
    "EstabMort",
    "plr2 idk"
}

game.Players.PlayerAdded:Connect(
    function(player)
        if table.find(Staff, player.Name) then
            player.Team = game.Teams.Staff
        end
    end
)
  • 0

                                                                        https://cdn.discordapp.com/attachments/909012795851407390/927492917394821140/siggy.png

TERIHAX

i say im gay as a joke 🙀

Posts: 1791

Threads: 92

Joined: Jul, 2020

Reputation: 30

Replied

@hookfunction what the hell the font kills me

  • 0

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )