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

How to make this Script Appliable For Certain Teams?

Asked by 3 years ago

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

Log in to vote
0
Answered by 3 years ago

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

0
Didnt Work For Some Reason. YT_AdamplaysUK 5 — 3y
0
Just to make sure I did it right: YT_AdamplaysUK 5 — 3y
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 YT_AdamplaysUK 5 — 3y
Ad
Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

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
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. Superexperiencedguy 199 — 3y
0
make it: game.Players.PlayerAdded:Connect(function(newplayer) Superexperiencedguy 199 — 3y
0
then, place the if statement within the function. It should work Superexperiencedguy 199 — 3y
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? YT_AdamplaysUK 5 — 3y

Answer this question