BoblokDevelopyyyr

leaderstatsAndCoins

Jan 4th, 2025
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 KB | None | 0 0
  1. game.Players.PlayerAdded:Connect(function(plr)
  2.     local leaderstats = Instance.new("Folder", plr)
  3.     leaderstats.Name = "leaderstats"
  4.    
  5.     local coins = Instance.new("NumberValue", leaderstats)
  6.     coins.Name = "Coins"
  7.     coins.Value = 0
  8.    
  9.     local RS = game:GetService("ReplicatedStorage")
  10.     local spawnEv = RS.Events.GUI.CoinSpawnEvent
  11.    
  12.     local coin = workspace.Coin
  13.     local one = "-9.583, 0.044, 2.421"
  14.     local second = "-17.37, 0.044, 2.798"
  15.     spawnEv.OnServerEvent:Connect(function(player, _)
  16.         local X = math.random(-17.37, -9.583)
  17.         local Y = 0.044
  18.         local Z = math.random(-0.035, 5.2)
  19.         local cl = coin:Clone()
  20.         cl.Parent = workspace
  21.         cl.Name = "SpawnedCoin"
  22.         cl.Position = Vector3.new(X, Y, Z)
  23.         local cl2 = game.ServerScriptService.valAdd:Clone()
  24.         cl2.Parent = cl
  25.         cl2.Enabled = true
  26.     end)
  27. end)
Add Comment
Please, Sign In to add comment