cbhusker
|
  |
| Joined: 07 Feb 2011 |
| Total Posts: 517 |
|
|
| 24 Jan 2015 05:27 PM |
Okay, so I have a spawnlocation that spawns the team "King", it's color is Very black. What I want it to be able to do is that you can join the team "AllowTeamChangeOnTouch", but ONLY when there is no one in the team at that moment.
So what I am basically saying, is you can only join the team if no one is in it.
I am willing to pay to get this script, Because I'm not very good at scripting, (at all), so yeah, Possibly pay if one of you people can make it for me.
- Thanks, Cbhusker |
|
|
| Report Abuse |
|
|
|
| 24 Jan 2015 05:31 PM |
Payment is not necessary. Simply put this script in the spawn, but make sure AllowTeamChangeOnTouch is false.
col = BrickColor.new(1003);
function _(h) local c = pcall(function() return h.Parent.Humanoid end); if (c) then local n = 0; for a,b in next,game.Players:getPlayers() do if(b.TeamColor==col) then n=n+1 end; end; if not (n>1) then game.Players[h.Parent.Name].TeamColor = col end; end; end;
script.Parent.Touched(_); |
|
|
| Report Abuse |
|
|
|
| 24 Jan 2015 05:32 PM |
Here it is for free Btw turn AllowTeamChangeOnTouch off And put this script inside the spawnlocation Wrote this from scratch so tell me if there are any bugs.
function getKing() for i,v in pairs(game.Players:GetChildren()) do if v.TeamColor == game.Teams.King.TeamColor then return true end end end script.Parent.Touched:connect(function(part) if part and part.Parent and game.Players:GetPlayerFromCharacter(part.Parent) then if not getKing() then game.Players:GetPlayerFromCharacter(part.Parent).TeamColor = game.Teams.King.TeamColor end end end) |
|
|
| Report Abuse |
|
|