Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR LUA

roblox pairs

--part 2

local Dates = {
  
  ["John"] = {
  
    ["Gender"] = "Male",
    ["From"] = "USA",
    ["RelationShip"] = "Single",
    ["Age"] = "20",
    ["RelationShip"] = "Gamming",
    ["Bank"] = 1000,
    
  },
  
    ["Emran"] = {
  
    ["Gender"] = "Male",
    ["From"] = "Saudi",
    ["RelationShip"] = "Taken",
    ["Age"] = "25",
    ["Hobby"] = "Oil Drilling",
    ["Bank"] = 1000000,
    
  },
  
      ["Anton"] = {
  
    ["Gender"] = "Male",
    ["From"] = "Spain",
    ["RelationShip"] = "Single",
    ["Age"] = "24",
    ["Hobby"] = "Football",
    ["Bank"] = 100000,
    
  },
  
    ["Harry"] = {
  
    ["Gender"] = "Male",
    ["From"] = "UK",
    ["RelationShip"] = "Taken",
    ["Age"] = "28",
    ["Hobby"] = "Drinking Tea",
    ["Bank"] = 10000,
    
  },
  
      ["Mohammed"] = {
  
    ["Gender"] = "Male",
    ["From"] = "Iraq",
    ["RelationShip"] = "Single",
    ["Age"] = "19",
    ["Hobby"] = "Programming",
    ["Bank"] = 100000,
    
  },
  
  }

function ChooseDate(Girl)
  
  local DateOptions = Girl[Options]
  local currentdate, currentpoint, finaloption
  local point = 0
  
  if DateOptions == nil then print("What kind of boy does the girl want??") return end
  
  for boy, info in pairs(Dates) do
    
    for optioni, optionv in pairs(DateOptions) do
      
      if optionv == "Any" then continue end
      
      if tonumber(info[optioni]) ~= nil then
        
        if info[optioni] >= optionv then print("Rich man very nice!") point++ end
        continue
      end
      
      if info[optioni] == "Taken" then print("You are taken thoe Wanna cheat ;)") end
      
      if info[optioni] == optionv then print("impressive!") point++ end
      
    end
    
    if currentdate then
      
      if point > currentpoint then
        
        print("Found a better date! sorry "..currentdate)
        currentpoint = point
        currentdate = boy
        point = 0
        continue
      end
      
      print("ill keep my old date!")
      continue
    end
    
    currentdate = boy
    currentpoint = point
    point = 0
  end
  finaloption = currentdate
  print("I choose "..finaloption.." he got "..currentpoint.." ill see u tonight ;)")
  
end

local Girl = {

	["Lisa"] = {
  
    ["Gender"] = "Female",
    ["From"] = "Germany",
    ["RelationShip"] = "Single",
    ["Age"] = "18",
    ["Hobby"] = "Exploring",
    ["Bank"] = 1000,
    
  },
  
  ["Options"] = {
  
  ["Gender"] = "Male",
  ["From"] = "Any",
  ["RelationShip"] = "Single",
  ["Age"] = "18",
  ["Hobby"] = "Any",
  ["Bank"] = 10000,
  
  },
  
}

-- this is hard to explain but if you don't get it
-- this is about a girl looking for a date this function
-- doesnt only use for loop once but twice there may have been a easier
-- way to achive this but ill keep it this way since it makes good sense

-- interpretation / explaination
-- there is 2 tables one for the girl and one for the boys
-- in these tables are more tables in this tables are values
-- and information about the persons age, name, sex...
-- we use this info and combining it with the girls date option
-- when a info is combined the point increases
-- the function saves a date if there is no date then it saves
-- the first boy it meets 1 is better then 0
-- if the old date points are worse then the new boys points
-- then the function will overwrite the old date with the new and better one
-- it goes until the end of the boy table then it we will get the lucky boy
-- this is not tested so i don't know wich will be the lucky one
-- this code made for fun because how complicated it could be
-- not everyone will learn from it so keep in mind
-- pairs goes through a table or it is a return function for v:Value
--output: [lucky boy]
 
PREVIOUS NEXT
Tagged: #roblox #pairs
ADD COMMENT
Topic
Name
9+2 =