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

Owner Teams. [closed]

Asked by 11 years ago

Say I have an owners team, but I only want it to show up when I join. How would I do it?

Locked by FearMeIAmLag

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

2 answers

Log in to vote
3
Answered by
blocco 185
11 years ago

What you would want to do is create a function which is called whenever a player joins. This function would check if the player is the creator of the place. If the player is the creator of the place, it would add a team to the game which only the creator could join. I added some extra functionality to the script, assuming you would want the team to remove itself when you leave, and I added the option for others to join the team when you're gone if it's not deleted (which is disabled by default). I also made it an option to prevent you from joining other teams.

Feel free to look through the code and see how it works.

01local preventJoiningOtherTeams = true;
02local removeTeamUponExit = true;
03local letOthersJoinTeamUponExit = false;
04local OwnerTeam = Instance.new("Team")
05    OwnerTeam.Name = "Team Name"
06    OwnerTeam.TeamColor = BrickColor.new("Really red")
07 
08function onPlayerAdded(player)
09    if player.userId == Game.CreatorId then -- assuming you're the creator
10        OwnerTeam.AutoAssignable = false
11        OwnerTeam.Parent = Game:GetService("Teams")
12        player.TeamColor = OwnerTeam.TeamColor
13        player.Changed:connect(function(property)
14            if preventJoiningOtherTeams and property == "TeamColor" and player.TeamColor ~= OwnerTeam.TeamColor then
15                player.TeamColor = OwnerTeam.TeamColor;
View all 32 lines...
0
Thanks. ChandlerTech 5 — 11y
Ad
Log in to vote
-1
Answered by 11 years ago

group = 133867 -- change to group ID deb = true function Check(p) if p ~= nil then deb = false local human = p.Parent if human ~= nil then local player = game.Players:GetPlayerFromCharacter(human) if player ~= nil then if player:IsInGroup(group) then player.TeamColor = BrickColor.new("Bright green") end end end end end script.Parent.Touched:connect(Check)

0
That is basicly what you gotta put just change group ID to your groups Id and if this isnt what you were looking for I am terribly sorry. AeonHack 0 — 11y