vlogergamer

All the shop scripts (Mele Studios)

May 18th, 2021
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. --leaderstats--
  2. game.Players.PlayerAdded:Connect(function(player)
  3. local leaderstats = Instance.new("Folder")
  4. leaderstats.Name = "leaderstats"
  5. leaderstats.Parent = player
  6.  
  7. local Cash = Instance.new("IntValue")
  8. Cash.Name = "Cash"
  9. Cash.Value = 100
  10. Cash.Parent = player.leaderstats
  11. end)
  12.  
  13. --close/open shop--
  14. db = false
  15. script.Parent.MouseButton1Click:Connect(function(clicked)
  16. if db == false then
  17. db = true
  18. script.Parent.Text = "Exit"
  19. script.Parent.Parent.Frame.Visible = true
  20. elseif db == true then
  21. db = false
  22. script.Parent.Text = "Shop"
  23. script.Parent.Parent.Frame.Visible = false
  24. end
  25. end)
  26.  
  27. --Buy script--
  28. script.Parent.MouseButton1Click:Connect(function(clicked)
  29. local player = script.Parent.Parent.Parent.Parent.Parent
  30. if player.leaderstats.Cash.Value == 100 or player.leaderstats.Cash.Value >= 100 then
  31. local parent = player.Backpack
  32. local sword = game.ReplicatedStorage.Tools.ClassicSword:Clone()
  33. player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - 100
  34. sword.Parent = parent
  35. elseif player.leaderstats.Cash.Value ~= 100 then
  36. script.Parent.Text = "Not enough money!"
  37. wait(2)
  38. script.Parent.Text = "Sword - 100"
  39. end
  40. end)
  41.  
  42. --The rest of the steps will be in the video!
Advertisement
Add Comment
Please, Sign In to add comment