Advertisement
GigaOrts

Untitled

Jun 22nd, 2025
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.83 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local function leaderboardSetup(player)
  3.     game.Workspace.Data.Player.Value = player
  4.     local leaderstats = Instance.new("Folder")
  5.     leaderstats.Name = "leaderstats"
  6.     leaderstats.Parent = player
  7.     local gold = Instance.new("IntValue")
  8.     gold.Name = "Money"
  9.     gold.Value = 100
  10.     gold.Parent = leaderstats
  11. end
  12. Players.PlayerAdded:Connect(leaderboardSetup)
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22. script.Parent.Humanoid.Died:Connect(function()
  23.     --новые команды
  24.     local coin = game.ServerStorage.Coin:Clone()
  25.     coin.Parent = game.Workspace.Coins
  26.     coin.Position = script.Parent.PrimaryPart.Position + Vector3.new(-2, 1, -2)
  27.     coin.Anchored = true
  28.     coin.CanCollide = false
  29.  
  30.  
  31.  
  32.     local s = script.Collect
  33.     s:Clone().Parent = coin
  34.     coin.Collect.Disabled = false
  35.  
  36.  
  37.  
  38.  
  39.     --это старые команды
  40.     print("NPC уничтожен")
  41.     wait(3)
  42.     script.Parent:Destroy()
  43.    
  44. end)
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52. script.Parent.Touched:Connect(function(hit)
  53.     if hit.Parent:FindFirstChild("Humanoid") then
  54.         local money = game.Workspace.Data.Player.Value.leaderstats.Money
  55.         money.Value += 10
  56.         script.Parent:Destroy()
  57.     end
  58. end)
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68. local ServerStorage = game:GetService("ServerStorage")
  69. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  70. local GiveWeaponEvent = ReplicatedStorage:WaitForChild("GiveWeapon")
  71.  
  72.  
  73. weapons = {
  74.     Gun1 = 100,
  75.     Gun2 = 200,
  76.     Gun3 = 300,
  77.     Gun4 = 400
  78. }
  79.  
  80. function onEvent1(player, gunName)
  81.    
  82.     if player.leaderstats.Money.Value >= weapons[gunName] then
  83.         local backpack = player:WaitForChild("Backpack")
  84.         local Gun = ServerStorage:FindFirstChild("Weapons"):FindFirstChild(gunName)
  85.         local clone = Gun:Clone()
  86.         clone.Parent = backpack
  87.         player.leaderstats.Money.Value -= weapons[gunName]
  88.     else
  89.         print("No money")
  90.     end
  91. end
  92. GiveWeaponEvent.OnServerEvent:Connect(onEvent1)
  93.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement