Advertisement
Marcel12311

Roblox Some Script (Polish language)

Aug 24th, 2021
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.32 KB | None | 0 0
  1. -- if u some not understand translate it (Polish -> English !)
  2. -- (1).Tworzymy w ServerScriptService Script
  3. -- (2).Wklejamy zawartosc do Script
  4. -- (3).Finito!
  5.  
  6. --------------------------------------------
  7. -- Male uwagi
  8. -- nawiasy w komentarzach to nazwy zmiennych
  9. ---------------------------------------------
  10.  
  11. -- glowna tabela przechowujaca dane wszystkich graczy
  12. local tablica = {}
  13.  
  14.  
  15. -- pojemnik na dane (zycie i nazwa)
  16. local dane = {
  17.     ["Name"] = "a",
  18.     ["Health"] = 2424
  19. }
  20.  
  21. game.Players.PlayerAdded:Connect(function(plr)
  22.     plr.CharacterAdded:Connect(function(character)
  23.         -- zmienna zapisujaca zycie po odrodzeniu sie gracza
  24.         local humanoid = character:WaitForChild("Humanoid").Health
  25.         -- tutaj zapisujemy imie i zycie graczy a nastepnie zapisujemy do pojemnika na dane
  26.         dane["Name"] = character.Name
  27.         dane["Health"] = humanoid
  28.         -- petla ktora wykonuje sie tyle razy ile jest informacji w pojemniku (dane)
  29.         for index,value in pairs(dane)do
  30.             -- po odrodzeniu sie gracza zapisujemy dane do tablicy  o nazwie (tablica)
  31.             table.insert(tablica,value)
  32.         end
  33.     end)
  34.    
  35.     -- gdy gracz padnie usuwamy z tablicy (tablica) wszystkie jego informacje
  36.     plr.CharacterRemoving:Connect(function(character)
  37.         for i=1,#tablica do
  38.             if tablica[i] == character.Name then
  39.                 table.remove(tablica,i+1)
  40.                 table.remove(tablica,i)
  41.             end
  42.         end
  43.     end)
  44.    
  45. end)
  46.  
  47. local function healthDown()
  48.     -- petla jezdzi po liscie graczy i automatycznie odejmuje 50 zycia wszystkim graczom
  49.     for i,v in pairs(game:GetService("Players"):GetPlayers()) do
  50.         wait(1.25)
  51.         local plr = v.Character
  52.         local health = plr.Humanoid
  53.         for i=1,#tablica do
  54.             if tablica[i] == v.Name then
  55.                 tablica[i+1] -= 50
  56.                 health.Health = tablica[i+1]
  57.                 if tablica[i+1] < 0 then
  58.                     health.Health = 0
  59.                     tablica[i+1] = 0
  60.                 end
  61.             end
  62.         end
  63.     end
  64. end
  65.  
  66. -- gdy gracz wychodzi z serwera automatycznie usuwamy z tablicy (tablica) jego dane
  67. game.Players.PlayerRemoving:Connect(function(plr)
  68.     for i=1,#tablica do
  69.  
  70.         if tablica[i] == plr.Name then
  71.             table.remove(tablica,i+1)
  72.             table.remove(tablica,i)
  73.         end
  74.         for i=1,#tablica do
  75.             print(tablica[i])
  76.         end
  77.     end
  78. end)
  79. wait(5)
  80. local function dupa()
  81.     for i=1,#tablica do
  82.         print(tablica[i])
  83.     end
  84. end
  85.  
  86. -- petla wykonujaca sie nieskonczonosc razy co 6 sek
  87. while wait(6)do
  88.     healthDown()
  89.     dupa()
  90. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement