How do I target a player in a script and change the variable used depending on the team?
Hello!
I tried adjusting a script that I found to fit my needs, but I don't know how to make it work. I'd like to make it so, depending on the players team, the different ID would be used.
For example, if the player is on the Bright yellow team, he'd have the "clothingstoreid" used and displayed above his head, but if he's on the Bright blue team, he'd have the "officeid" id used.
How would I do this? The place is filtering enabled.
Thanks in advance!
01 | clothingstoreid = 3324859 |
05 | game.Players.PlayerAdded:connect(onPlayerRespawned) |
06 | function onPlayerRespawned(newPlayer) |
09 | gui = Instance.new( "BillboardGui" ) |
10 | gui.Parent = newPlayer.Character.Head |
11 | gui.Adornee = newPlayer.Character.Head |
12 | gui.Size = UDim 2. new( 4 , 0 , 2 , 0 ) |
13 | gui.StudsOffset = Vector 3. new( 0 , 3 , 0 ) |
14 | texta = Instance.new( "TextBox" ) |
15 | texta.Size = UDim 2. new( 1 , 0 , 1 , 0 ) |
16 | texta.BackgroundTransparency = 1 |
17 | texta.Text = ( "[ " .. newPlayer:GetRoleInGroup(clothingstoreid) .. " ]" ) |
18 | texta.TextColor 3 = Color 3. new( 50 , 10 , 255 ) |
20 | if newPlayer:IsInGroup(clothingstoreid) then |
21 | texta.TextColor 3 = Color 3. new( 50 , 10 , 255 ) |
26 | function onPlayerEntered(newPlayer) |
27 | newPlayer.Changed:connect( function (property) |
28 | if (property = = "Character" ) then |
29 | onPlayerRespawned(newPlayer) |
34 | game.Players.PlayerAdded:connect(onPlayerEntered) |