Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
local TeleportService = game:GetService("TeleportService") local VIP = 64418164 local LivesSave = game:GetService("DataStoreService"):GetDataStore("Lives") game.Players.PlayerAdded:Connect(function(player) local previousData = LivesSave:GetAsync(player.UserId) -- Returns a number value. local Lives if previousData ~= nil then Lives = previousData else Lives = 0 LivesSave:SetAsync(player.UserId, 0) end local LivesValue = Instance.new("IntValue", player) LivesValue.Name = "Lives" LivesValue.Value = Lives player.Lives.Value = 3 end) game:BindToClose(function() -- Runs whenver the server is about to shut down/stop. print("STOPPED!") for i,player in pairs(game.Players:GetPlayers()) do local value = player.Lives.Value LivesSave:SetAsync(player.UserId, value) print("Saved data for "..player.Name) end end) game.Players.PlayerRemoving:Connect(function(player) local value = player.Lives.Value if value ~= nil then print("Found data to save for "..player.Name.."!") LivesSave:SetAsync(player.UserId, value) print("Saved data for "..player.Name) else print("Did not manage to find data to save for "..player.Name.."!") end end) local CoinsSave = game:GetService("DataStoreService"):GetDataStore("Coins") game.Players.PlayerAdded:Connect(function(player) local previousData = CoinsSave:GetAsync(player.UserId) -- Returns a number value. local Coins if previousData ~= nil then Coins = previousData else Coins = 0 CoinsSave:SetAsync(player.UserId, 0) end local coinsValue = Instance.new("IntValue", player) coinsValue.Name = "Coins" coinsValue.Value = Coins if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, VIP) then player.Coins.Value = player.Coins.Value * 2 end end) game:BindToClose(function() -- Runs whenver the server is about to shut down/stop. print("STOPPED!") for i,player in pairs(game.Players:GetPlayers()) do local value = player.Coins.Value CoinsSave:SetAsync(player.UserId, value) print("Saved data for "..player.Name) end end) game.Players.PlayerRemoving:Connect(function(player) local value = player.Coins.Value if value ~= nil then print("Found data to save for "..player.Name.."!") CoinsSave:SetAsync(player.UserId, value) print("Saved data for "..player.Name) else print("Did not manage to find data to save for "..player.Name.."!") end end)
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)