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

How do I target a player in a script and change the variable used depending on the team?

Asked by 7 years ago

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!

01clothingstoreid = 3324859  --Write your group's id right here, you don't need to worry about anything else, unless you plan on changing colors.
02officeid = 2989165
03familyid = 0
04restuarantid = 0
05game.Players.PlayerAdded:connect(onPlayerRespawned) --Connection for the function right below.
06function onPlayerRespawned(newPlayer) --When a player joins the "Players" service.
07    wait(1) --Obviously waits to start the script
08    if newPlayer then --Just checking if the player exist.
09        gui=Instance.new("BillboardGui") --Creating a new BillboardGui
10        gui.Parent=newPlayer.Character.Head --Inserting the BillboardGui into the player.
11        gui.Adornee=newPlayer.Character.Head
12        gui.Size=UDim2.new(4,0,2,0) --Leave this one be.
13        gui.StudsOffset=Vector3.new(0,3,0) --Leave this one be.
14        texta=Instance.new("TextBox") --Creating a new TextBox
15        texta.Size=UDim2.new(1,0,1,0) --Leave this one be.
View all 34 lines...

1 answer

Log in to vote
0
Answered by
Sekant 20
7 years ago
Edited 7 years ago

Try this out. [edited]

01clothingstoreid = 3324859 
02officeid = 2989165
03familyid = 0
04restuarantid = 0
05 
06 
07 
08function onPlayerRespawned(newPlayer)
09 
10    wait(1)
11 
12        local gui=Instance.new("BillboardGui")
13        gui.Parent=newPlayer.Character.Head
14        gui.Adornee=newPlayer.Character.Head
15        gui.Size=UDim2.new(0,100,0,50)
View all 41 lines...
0
"Attempt to connect failed: Passed value is not a function" "attempt to call a nil value" Aperturee 22 — 7y
0
What line is that on? Sekant 20 — 7y
0
Doesn't let me click on it. Aperturee 22 — 7y
0
Ok now try Sekant 20 — 7y
0
There's no errors, but there's no Gui's either now. Aperturee 22 — 7y
Ad

Answer this question