Advertisement
2005zeus

Boat Spawn

Oct 10th, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.87 KB | None | 0 0
  1. -- Local Script
  2. local guiItems = script.Parent:GetChildren()
  3. local player = game.Players.LocalPlayer
  4.  
  5. workspace["NPC man"].ClickDetector.MouseClick:Connect(function()
  6.     script.Parent.Visible = true
  7. end)
  8.  
  9.  
  10. for _, thing in pairs(guiItems)do
  11.     if thing:IsA("TextButton")then
  12.         thing.Activated:Connect(function()
  13.             game.ReplicatedStorage.UpdateLeaderboards:FireServer(thing.Cost.Value, thing)
  14.             script.Parent.Visible = false
  15.         end)
  16.     end
  17. end
  18.  
  19.  
  20. -- Server script
  21. local isRunning = false
  22. game.ReplicatedStorage.UpdateLeaderboards.OnServerEvent:Connect(function(player, value, thing)
  23.     if isRunning == false then
  24.         isRunning = true
  25.         player.leaderstats["Monett $_$"].Value -= value
  26.         local clone = game.ServerStorage[thing.Name]:Clone()
  27.         clone.Parent = workspace.Part
  28.         clone.Position = workspace.Part.Position + Vector3.new(0, 5, 0)
  29.         wait(1)
  30.         isRunning = false
  31.     end
  32. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement