Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- if u some not understand translate it (Polish -> English !)
- -- (1).Tworzymy w ServerScriptService Script
- -- (2).Wklejamy zawartosc do Script
- -- (3).Finito!
- --------------------------------------------
- -- Male uwagi
- -- nawiasy w komentarzach to nazwy zmiennych
- ---------------------------------------------
- -- glowna tabela przechowujaca dane wszystkich graczy
- local tablica = {}
- -- pojemnik na dane (zycie i nazwa)
- local dane = {
- ["Name"] = "a",
- ["Health"] = 2424
- }
- game.Players.PlayerAdded:Connect(function(plr)
- plr.CharacterAdded:Connect(function(character)
- -- zmienna zapisujaca zycie po odrodzeniu sie gracza
- local humanoid = character:WaitForChild("Humanoid").Health
- -- tutaj zapisujemy imie i zycie graczy a nastepnie zapisujemy do pojemnika na dane
- dane["Name"] = character.Name
- dane["Health"] = humanoid
- -- petla ktora wykonuje sie tyle razy ile jest informacji w pojemniku (dane)
- for index,value in pairs(dane)do
- -- po odrodzeniu sie gracza zapisujemy dane do tablicy o nazwie (tablica)
- table.insert(tablica,value)
- end
- end)
- -- gdy gracz padnie usuwamy z tablicy (tablica) wszystkie jego informacje
- plr.CharacterRemoving:Connect(function(character)
- for i=1,#tablica do
- if tablica[i] == character.Name then
- table.remove(tablica,i+1)
- table.remove(tablica,i)
- end
- end
- end)
- end)
- local function healthDown()
- -- petla jezdzi po liscie graczy i automatycznie odejmuje 50 zycia wszystkim graczom
- for i,v in pairs(game:GetService("Players"):GetPlayers()) do
- wait(1.25)
- local plr = v.Character
- local health = plr.Humanoid
- for i=1,#tablica do
- if tablica[i] == v.Name then
- tablica[i+1] -= 50
- health.Health = tablica[i+1]
- if tablica[i+1] < 0 then
- health.Health = 0
- tablica[i+1] = 0
- end
- end
- end
- end
- end
- -- gdy gracz wychodzi z serwera automatycznie usuwamy z tablicy (tablica) jego dane
- game.Players.PlayerRemoving:Connect(function(plr)
- for i=1,#tablica do
- if tablica[i] == plr.Name then
- table.remove(tablica,i+1)
- table.remove(tablica,i)
- end
- for i=1,#tablica do
- print(tablica[i])
- end
- end
- end)
- wait(5)
- local function dupa()
- for i=1,#tablica do
- print(tablica[i])
- end
- end
- -- petla wykonujaca sie nieskonczonosc razy co 6 sek
- while wait(6)do
- healthDown()
- dupa()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement