Advertisement
laurencessko

Simulator Lol

May 17th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. ToolHandler
  2. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  3. local RemoteEvents = ReplicatedStorage.RemoteEvents
  4. local CoinClicked = RemoteEvents.CoinClicked
  5.  
  6. CoinClicked.OnServerEvent:Connect(function(player, Strength)
  7. if player.PlayerStats.CurrentValue.Value < player.PlayerStats.Storage.Value then
  8. player:WaitForChild("PlayerStats").CurrentValue.Value = player.PlayerStats.CurrentValue.Value + Strength
  9. end
  10. end)
  11. TeleportHandler
  12. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  13. local RemoteEvents = ReplicatedStorage.RemoteEvents
  14. local TeleportToShop = RemoteEvents.TeleportToShop
  15.  
  16. TeleportToShop.OnServerEvent:Connect(function(Player)
  17. local Character = Player.Character
  18. Character:MoveTo(game.Workspace.SellButton.Position + Vector3.new (0,1,0))
  19. end)
  20. SellHandler
  21. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  22. local RemoteEvents = ReplicatedStorage.RemoteEvents
  23. local Sold = RemoteEvents.ItemSold
  24.  
  25. local Debounce = false
  26.  
  27. script.Parent.Touched:Connect(function(hit)
  28. if hit.Parent:FindFirstChild("Humanoid") then
  29. local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
  30. if Player.PlayerStats.CurrentValue.Value > 0 then
  31. if Debounce == false then
  32. Debounce = true
  33. Sold:FireClient(Player, Player.PlayerStats.CurrentValue.Value)
  34. Player.PlayerStats.Coins.Value = Player.PlayerStats.Coins.Value + Player.PlayerStats.CurrentValue.Value
  35. Player.PlayerStats.CurrentValue.Value = 0
  36. wait()
  37. Debounce = false
  38. end
  39. end
  40. end
  41. end)
  42. ToolScript
  43. local tool = script.Parent
  44.  
  45.  
  46. local Settings = tool:WaitForChild("Settings")
  47. local Strength = Settings.Strength
  48.  
  49.  
  50. local Player = game.Players.localPlayer
  51. local PlayerUI = Player:WaitForChild("PlayerGui").PlayerUI
  52.  
  53.  
  54. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  55. local RemoteEvents = ReplicatedStorage:WaitForChild("RemoteEvents")
  56. local CoinClicked = RemoteEvents.CoinClicked
  57.  
  58.  
  59. local Debounce = false
  60.  
  61.  
  62. tool.Activated:Connect(function()
  63. if Player.PlayerStats.CurrentValue.Value > Player.PlayerStats.Storage.Value then
  64. if Debounce == false then
  65. Debounce = true
  66. CoinClicked:FireServer(Strength.Value)
  67. wait(0.25)
  68. Debounce = false
  69. end
  70. else
  71. if PlayerUI.StorageFull.Visible == false then
  72. if Debounce == false then
  73. Debounce = true
  74. PlayerUI.StorageFull.Visible = true
  75. wait(0.5)
  76. Debounce = false
  77. end
  78. end
  79. end
  80. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement