generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Gah, can someone show me how to make this work?

Previous Thread :: Next Thread 
Rencedalas is not online. Rencedalas
Joined: 05 Jul 2010
Total Posts: 930
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
nickbricknick464 is not online. nickbricknick464
Joined: 22 Aug 2008
Total Posts: 8302
22 May 2012 11:47 AM
As far as I can judge its only changing the team color not the team
Report Abuse
Rencedalas is not online. Rencedalas
Joined: 05 Jul 2010
Total Posts: 930
22 May 2012 11:47 AM
Mmk, how would i put a player into a team?
Report Abuse
legokid135 is not online. legokid135
Joined: 23 Jan 2009
Total Posts: 1470
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
Rencedalas is not online. Rencedalas
Joined: 05 Jul 2010
Total Posts: 930
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
Rencedalas is not online. Rencedalas
Joined: 05 Jul 2010
Total Posts: 930
22 May 2012 11:55 AM
bumpity bump
Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
22 May 2012 12:04 PM
allies = {523523,25352525,2352352}

-[ ɥsɐɯsɹǝƃuɐɹ ]-
Report Abuse
Rencedalas is not online. Rencedalas
Joined: 05 Jul 2010
Total Posts: 930
22 May 2012 12:06 PM
Ohhh...
Report Abuse
Rencedalas is not online. Rencedalas
Joined: 05 Jul 2010
Total Posts: 930
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
Rencedalas is not online. Rencedalas
Joined: 05 Jul 2010
Total Posts: 930
22 May 2012 12:15 PM
so then, does nobody know how to do this?
Report Abuse
Rencedalas is not online. Rencedalas
Joined: 05 Jul 2010
Total Posts: 930
22 May 2012 04:18 PM
BUUUUUMP
Report Abuse
Rencedalas is not online. Rencedalas
Joined: 05 Jul 2010
Total Posts: 930
22 May 2012 04:41 PM
Rencedalas uses "Bump"
It was very effective.
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
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 is not online. 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 is not online. 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
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
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
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
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
Rencedalas is not online. Rencedalas
Joined: 05 Jul 2010
Total Posts: 930
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
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
22 May 2012 04:59 PM
Umm, for my script or yours?
Report Abuse
Rencedalas is not online. Rencedalas
Joined: 05 Jul 2010
Total Posts: 930
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
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
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
Rencedalas is not online. Rencedalas
Joined: 05 Jul 2010
Total Posts: 930
22 May 2012 05:02 PM
but spawn them at the main groups spawns and put them in the main groups team?
Report Abuse
Rencedalas is not online. Rencedalas
Joined: 05 Jul 2010
Total Posts: 930
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
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
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
Rencedalas is not online. Rencedalas
Joined: 05 Jul 2010
Total Posts: 930
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image