|
| 22 May 2012 11:45 AM |
I made a script to sort players into teams based on if they are in a certain group, the previous script i made put players in the home clan into allies if they were in an ally group and the main clan, this one put everyone in my "undefined" team and puts them on a random spawn to start out but when they die, they spawn in the correct spawn, the undefined spawn, even if they are ally or home clan. Here is the script and there is no error log.
wait(1) print ("Spawn system successfully loaded!")
id = 370329 --Change the number to your group ID allies = {{277680}}
game.Players.PlayerAdded:connect(function(p) if p:IsInGroup(id) then p.TeamColor = BrickColor.new("Black") p.Character:BreakJoints() else if p:IsInGroup(allies) then p.TeamColor = BrickColor.new("Dark green") p.Character:BreakJoints() elseif p:IsInGroup(allies)==true and p:IsInGroup(id)==true then p.TeamColor = BrickColor.new("Black") p.Character:BreakJoints() else p.TeamColor = BrickColor.new("Bright red") end end end end)
this script does not put you in any team when you join the game unless there is an autoassignable team, when there is an autoassignable team, that is the ONLY team you get in, even if you are in the group or in the ally group, what i need this script to do is give a player a team based on if they are in the group or ally group and make them spawn there automatically if they are not in the group it should spawn them as a neutral/raider automatically without spawning players at random spawns that they shouldnt be at. |
|
|
| Report Abuse |
|
|
|
| 22 May 2012 11:47 AM |
| As far as I can judge its only changing the team color not the team |
|
|
| Report Abuse |
|
|
|
| 22 May 2012 11:47 AM |
| Mmk, how would i put a player into a team? |
|
|
| Report Abuse |
|
|
|
| 22 May 2012 11:48 AM |
allies = {{277680}}
It should only be one curly wurly.
allies = {277680}
~ My RPG is in BETA: http://www.roblox.com/--place?id=80741686 ~ |
|
|
| Report Abuse |
|
|
|
| 22 May 2012 11:49 AM |
even if i want to add more? i only put one to test if it would assign teams even if you are in both, because i own both of those groups. |
|
|
| Report Abuse |
|
|
| |
|
|
| 22 May 2012 12:04 PM |
allies = {523523,25352525,2352352}
-[ ɥsɐɯsɹǝƃuɐɹ ]- |
|
|
| Report Abuse |
|
|
| |
|
|
| 22 May 2012 12:09 PM |
so then can anyone show me how ot make it change team, not just teamcolor? without an autoassignable team, this script does nothing, with an autoassignable, it only puts you into the autoassignable... |
|
|
| Report Abuse |
|
|
|
| 22 May 2012 12:15 PM |
| so then, does nobody know how to do this? |
|
|
| Report Abuse |
|
|
| |
|
|
| 22 May 2012 04:41 PM |
Rencedalas uses "Bump" It was very effective. |
|
|
| Report Abuse |
|
|
|
| 22 May 2012 04:47 PM |
...I'm just going to remake this whole thing.
local id = 370329 local allies = {277680, 00000000} --notice how I added another ID?
function checkIfAlly(p) for k,v in pairs(allies) do if p:IsInGroup(v) then return true else return false end end end
game.Players.PlayerAdded:connect(function(player) if p:IsInGroup(id) then player.TeamColor = BrickColor.new("Black") elseif checkIfAlly(player) then p.TeamColor = BrickColor.new("Dark green") else p.TeamColor = BrickColor.new("Bright red") end end) |
|
|
| Report Abuse |
|
|
rawwars
|
  |
| Joined: 01 Dec 2009 |
| Total Posts: 172 |
|
|
| 22 May 2012 04:49 PM |
| Shouldn't it say "...connect(function(player)..." not "...connect(function(p)..."? |
|
|
| Report Abuse |
|
|
rawwars
|
  |
| Joined: 01 Dec 2009 |
| Total Posts: 172 |
|
|
| 22 May 2012 04:50 PM |
| You never assigned "p". Maybe that's the problem. I'm new to scripting, so I'm not sure, but the "p" instead of "player" caught my eye. |
|
|
| Report Abuse |
|
|
|
| 22 May 2012 04:54 PM |
| What are you talking about? I did assign the player paramater as "player". That should work just fine, |
|
|
| Report Abuse |
|
|
|
| 22 May 2012 04:56 PM |
Oh, fail, you were talking about his script. Never mind.
Anyway, that doesn't matter - that's just a variable. It can be anything. |
|
|
| Report Abuse |
|
|
|
| 22 May 2012 04:57 PM |
Yay! Thank you so much! i noticed, inside my fort the teamcolor doesnt matter, it assigns you to a random spawn, how can i fix this? or was it my script? |
|
|
| Report Abuse |
|
|
|
| 22 May 2012 04:59 PM |
| Umm, for my script or yours? |
|
|
| Report Abuse |
|
|
|
| 22 May 2012 05:01 PM |
| Mine and some from the freemodels, what was making the player spawn at a different teams spawn each time? and does your script allow players to be in a group from allies and the main group? |
|
|
| Report Abuse |
|
|
|
| 22 May 2012 05:02 PM |
| The fact that your script didn't even run. It had several syntax errors that prevented it from even starting to run. |
|
|
| Report Abuse |
|
|
|
| 22 May 2012 05:02 PM |
| but spawn them at the main groups spawns and put them in the main groups team? |
|
|
| Report Abuse |
|
|
|
| 22 May 2012 05:03 PM |
| ah....does yours allow players to be in an ally and the main group but put them in the main groups team and spawn? |
|
|
| Report Abuse |
|
|
|
| 22 May 2012 05:05 PM |
I'm not sure. Use this instead:
local id = 370329 local allies = {277680, 00000000} --notice how I added another ID? function checkIfAlly(p) for k,v in pairs(allies) do if p:IsInGroup(v) then return true else return false end end end game.Players.PlayerAdded:connect(function(player) if p:IsInGroup(id) and not checkIfAlly(player) then player.TeamColor = BrickColor.new("Black") elseif checkIfAlly(player) and not p:IsInGroup(id) then p.TeamColor = BrickColor.new("Dark green") elseif p:IsInGroup(id) and checkIfAlly(player) then player.TeamColor = BrickColor.new("Black") else p.TeamColor = BrickColor.new("Bright red") end end) |
|
|
| Report Abuse |
|
|
|
| 22 May 2012 05:16 PM |
Okay, thanks heaps. Very last question, What causes a player to spawn on a spawnlocation that isnt for their team and what should i do to make that not happen? |
|
|
| Report Abuse |
|
|