This is a forum where you can chat about things on roblox or just chat about roblox, even if you do not play roblox sign up and i can send you the link to roblox on here (its a really enjoyable and creative game)
Home­Calendar­FAQ­Search­Memberlist­Usergroups­Register­Log in
Post new topic   Reply to topicShare | 
 

 Picking people from a team

View previous topic View next topic Go down 
AuthorMessage
KingJavon



Posts: 2
Join date: 2009-06-20
Location: Ohio

PostSubject: Picking people from a team   Sat Jun 20, 2009 10:32 pm

I'm making a script for my firend and one of the things he needs is to pick two random people on a team then send them to a one of two vector points.
Back to top Go down
View user profile
Meelo



Posts: 3
Join date: 2009-06-19

PostSubject: Re: Picking people from a team   Sun Jun 21, 2009 4:25 am

local Point1 = Vector3.new(0,0,0) --Where you want to send 1
local Point2 = Vector3.new(0,0,0) --Where you want to send the other
...
function Move(TeamColor)
local plyrs = {}
for i,v in ipairs(game.Players:GetChildren())do
if(v.TeamColor == TeamColor)then
if(pcall(function() assert(v.Character.Torso) end))then
table.insert(plyrs,v)
end
end
end
local rand1 = math.random(#plyrs)
local choice1 = plyrs[rand1]
table.remove(plyrs,rand1)
local choice2 = plyrs[math.random(#plyrs)]
choice1.Character.Torso.CFrame = CFrame.new(Point1)
choice2.Character.Torso.CFrame = CFrame.new(Point2)
end

(BTW, we're trying to restart our forums here KingJavon http://robloxcentral.forummotion.com/forum.htm)
Back to top Go down
View user profile
 

Picking people from a team

View previous topic View next topic Back to top 
Page 1 of 1

Permissions of this forum:You can reply to topics in this forum
Roblox forum :: Roblox Lua/scripting :: roblox lua-
Post new topic   Reply to topic