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

How to make this Script Appliable For Certain Teams?

So. I have an SCP Group with Diffrent Teams and Diffrent Groups.

I currently Have this Code:

groupid = 8691880
groupn = "SCPF: Special Containment & Procedures."



game.Players.PlayerAdded:connect(onPlayerRespawned)
function onPlayerRespawned(newPlayer)
	wait(1)
	if newPlayer:IsInGroup(groupid) then
		guigroup=Instance.new("BillboardGui")
		guigroup.Parent=newPlayer.Character.Head
		guigroup.Adornee=newPlayer.Character.Head
		guigroup.Size=UDim2.new(4,0,2,0)
		guigroup.StudsOffset=Vector3.new(0,3,0)
		textgroup=Instance.new("TextLabel")
		textgroup.Size=UDim2.new(1,0,1,0)
		textgroup.BackgroundTransparency = 1
		textgroup.TextColor3 = Color3.new(255/255, 255/255, 255/255)
		textgroup.TextStrokeTransparency = 0
		textgroup.TextTransparency = 0
		textgroup.FontSize = 'Size10'
		UnrefinedRank = newPlayer:GetRankInGroup(groupid)
		Person = newPlayer.Name
		


		if UnrefinedRank == 255 then
				UnrefinedRank = " The Administrator "
				
		end	
		
		if UnrefinedRank == 14 then
				UnrefinedRank = " [REDACTED] "
				
		end	
		
		if UnrefinedRank == 13 then
			UnrefinedRank = " [REDACTED] "
				
		end	
			
		if UnrefinedRank == 12 then
				UnrefinedRank = " Facility Manager "
				
		end	
			
		if UnrefinedRank == 11 then
				UnrefinedRank = " Site Director "
				
		end	
		
		if UnrefinedRank == 10 then
				UnrefinedRank = " Facility Manager "
				
		end		
		
		if UnrefinedRank == 8 then
				UnrefinedRank = " Level-5 "
				
		end		
		
		if UnrefinedRank == 7 then
				UnrefinedRank = " Level-4 "
		
		end 
		
   		if UnrefinedRank == 6 then
				UnrefinedRank = " Level-3 "
		
		end 
		
		if UnrefinedRank == 5 then
				UnrefinedRank = " Level-2 "
		
		end 
		
		if UnrefinedRank == 4 then
			UnrefinedRank = " Level-1 "

		end
		
		if UnrefinedRank == 3 then
			UnrefinedRank = " Level-o "

		end
		
		if UnrefinedRank == 2 then
			 	UnrefinedRank = (" Class E "..math.random(10,99))
			
		end
		
		if UnrefinedRank == 1 then
				UnrefinedRank = (" Class D "..math.random(1000,9999))
				
      end
		
		textgroup.Text = ('[ '.. groupn .. ' ] ' .. UnrefinedRank .. " " .. Person  )
		textgroup.Parent=guigroup
		
	end
end



function onPlayerEntered(newPlayer)
	newPlayer.Changed:connect(function (property)
		if (property == "Character") then
			onPlayerRespawned(newPlayer)
		end
	end)
end

	game.Players.PlayerAdded:connect(onPlayerEntered)

What this does is It gives a over head GUI To Everyone On Any Teams It Looks Like This:

https://gyazo.com/dfed2bed1aa56a40172bb5a0a97d6526

What I want to do is. Make it so Only People in the Certain Team Make this script enabled. So I can change thsi script for every team. For Example: Only People on the [IA] Team will get That Script With those ranks but everyone else dont. And for other ones i can edit it ect..

This is kinda a request if someone can make it for me Epic Or if someone can just edit it with the team thing. Please. I need help with this.

2 answers

Just insert this if statement into your code:

local teams = game:GetService("Teams")
if newPlayer.Team == teams:WaitForChild("Team") then -- change the team in speech marks to whatever team you need it to be
     --code here
end

Hope this has helped :) If so pls accept as answer

3 comments

0

Didnt Work For Some Reason.

0

Just to make sure I did it right:

0

local teams = game:GetService("Teams") if newPlayer.Team == teams:WaitForChild("[TA] The Administrator") then -- change the team in speech marks to whatever team you need it to be --code here groupid = 8691880 groupn = "SCPF: Special Containment & Procedures." game.Players.PlayerAdded:connect(onPlayerRespawned) function onPlayerRespawned(newPlayer) wait(1) if newPlayer:IsInGroup(groupid) the

I tried This - Thank you Superexperiancedguy But Did I do it wrong? Because It doesnt work.

local teams = game:GetService("Teams")
if newPlayer.Team == teams:WaitForChild("[TA] The Administrator") then -- change the team in speech marks to whatever team you need it to be
--code here

groupid = 8691880
groupn = "SCPF: Special Containment & Procedures."



game.Players.PlayerAdded:connect(onPlayerRespawned)
function onPlayerRespawned(newPlayer)
	wait(1)
	if newPlayer:IsInGroup(groupid) then
		guigroup=Instance.new("BillboardGui")
		guigroup.Parent=newPlayer.Character.Head
		guigroup.Adornee=newPlayer.Character.Head
		guigroup.Size=UDim2.new(4,0,2,0)
		guigroup.StudsOffset=Vector3.new(0,3,0)
		textgroup=Instance.new("TextLabel")
		textgroup.Size=UDim2.new(1,0,1,0)
		textgroup.BackgroundTransparency = 1
		textgroup.TextColor3 = Color3.new(255/255, 255/255, 255/255)
		textgroup.TextStrokeTransparency = 0
		textgroup.TextTransparency = 0
		textgroup.FontSize = 'Size10'
		UnrefinedRank = newPlayer:GetRankInGroup(groupid)
		Person = newPlayer.Name
		


		if UnrefinedRank == 255 then
				UnrefinedRank = " The Administrator "
				
		end	
		
		if UnrefinedRank == 14 then
				UnrefinedRank = " [REDACTED] "
				
		end	
		
		if UnrefinedRank == 13 then
			UnrefinedRank = " [REDACTED] "
				
		end	
			
		if UnrefinedRank == 12 then
				UnrefinedRank = " Facility Manager "
				
		end	
			
		if UnrefinedRank == 11 then
				UnrefinedRank = " Site Director "
				
		end	
		
		if UnrefinedRank == 10 then
				UnrefinedRank = " Facility Manager "
				
		end		
		
		if UnrefinedRank == 8 then
				UnrefinedRank = " Level-5 "
				
		end		
		
		if UnrefinedRank == 7 then
				UnrefinedRank = " Level-4 "
		
		end 
		
   		if UnrefinedRank == 6 then
				UnrefinedRank = " Level-3 "
		
		end 
		
		if UnrefinedRank == 5 then
				UnrefinedRank = " Level-2 "
		
		end 
		
		if UnrefinedRank == 4 then
			UnrefinedRank = " Level-1 "

		end
		
		if UnrefinedRank == 3 then
			UnrefinedRank = " Level-o "

		end
		
		if UnrefinedRank == 2 then
			 	UnrefinedRank = (" Class E "..math.random(10,99))
			
		end
		
		if UnrefinedRank == 1 then
				UnrefinedRank = (" Class D "..math.random(1000,9999))
				
      end
		
		textgroup.Text = ('[ '.. groupn .. ' ] ' .. UnrefinedRank .. " " .. Person  )
		textgroup.Parent=guigroup
		
	end
end



function onPlayerEntered(newPlayer)
	newPlayer.Changed:connect(function (property)
		if (property == "Character") then
			onPlayerRespawned(newPlayer)
		end
	end)
end

	game.Players.PlayerAdded:connect(onPlayerEntered)
end

4 comments

0

Oh. You put it outside of the function itself. The if statement is supposed to be INSIDE of the function, since i am refering to "newplayer", which is stated in the function. Also, your first line is a bit weird.

0

make it: game.Players.PlayerAdded:Connect(function(newplayer)

0

then, place the if statement within the function. It should work

0

ould you possibly add me on diz- CG_CodeGamer# 75 00 and possible re-post the whole script for me so i dont mess it up?

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