Advertisement
Afraid4_COol

Untitled

Apr 29th, 2021
861
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.06 KB | None | 0 0
  1. --// Get Basic Items
  2. local ShopFrame = script.Parent
  3. local SkinsSection = script.Parent.SkinsSection
  4. local GampassSection = script.Parent.GampassSection
  5. local EarnCashEvent = game.ReplicatedStorage.ServerEvents:FindFirstChild("EarnCash")
  6. local SkinsModule = require(game.ReplicatedStorage.Modules:FindFirstChild("Skins"))
  7. local InventoryGui = script.Parent.Parent.Parent:WaitForChild("InventoryGui")
  8. local PlayersCash
  9.  
  10. --// Get Skin Items
  11. local Skin1 = SkinsSection.SkinOne
  12. local Skin2 = SkinsSection.SkinTwo
  13. local Skin3 = SkinsSection.SkinThree
  14. local Skin1Text = Skin1.TextLabel
  15. local Skin2Text = Skin2.TextLabel
  16. local Skin3Text = Skin3.TextLabel
  17. local Price1 = Skin1.PriceLabel
  18. local Price2 = Skin2.PriceLabel
  19. local Price3 = Skin3.PriceLabel
  20.  
  21. --// Get Gamepass Items
  22. local Gamepass1 = GampassSection.CustomNamesPass
  23. local Gamepass2 = GampassSection.BlankPass1
  24. local Gamepass3 = GampassSection.BlankPass2
  25.  
  26. --// Setup Skin Shop
  27.     --//Daily Skins Set-up
  28. local DailySkin1 = SkinsModule.Null
  29. local DailySkin2 = SkinsModule.MBGuy
  30. local DailySkin3 = SkinsModule.MBGirl
  31.     --// Set up Skin 1
  32. Skin1.Image = DailySkin1.Decal
  33. Skin1Text.Text = DailySkin1.Name
  34. Price1.Text = "$"..DailySkin1.Price
  35.     --// Set up Skin 2
  36. Skin2.Image = DailySkin2.Decal
  37. Skin2Text.Text = DailySkin2.Name
  38. Price2.Text = "$"..DailySkin2.Price
  39.     --// Set up Skin 3
  40. Skin3.Image = DailySkin3.Decal
  41. Skin3Text.Text = DailySkin3.Name
  42. Price3.Text = "$"..DailySkin3.Price
  43.  
  44. --// Purchasing skins
  45.     --// Purchase Skin Function
  46. local function PurchaseSkin(SkinImage, SkinName)
  47.     local InventoryNotification = script.Parent.Parent.Parent.Topbar.TopbarContainer.Inventory.IconButton.Notification
  48.     local InvExample = InventoryGui.MainFrame.Example
  49.     local InventoryItem = InvExample:Clone()
  50.     InventoryItem.Parent = InventoryGui.MainFrame.ScrollingFrame
  51.     InventoryItem.Visible = true
  52.     InventoryItem.Name = SkinName
  53.     InventoryItem.Image = SkinImage
  54.     InventoryItem.TextLabel.Text = SkinName
  55.    
  56.     InventoryNotification.Visible = true
  57.     InventoryNotification.Amount.Value.Value = InventoryNotification.Amount.Value.Value + 1
  58.     InventoryNotification.Amount.Text = InventoryNotification.Amount.Value.Value
  59.     if InventoryNotification.Amount.Value.Value >= 99 then
  60.         InventoryNotification.Amount.Text = "99+"
  61.     end
  62. end
  63.  
  64. --// Purchasing Item
  65. Skin1.MouseButton1Click:Connect(function()
  66.     PlayersCash = game.Players.LocalPlayer.PlayerValues.Cash.Value
  67.     if PlayersCash <= SkinsModule.Null.Price then return end
  68.     PurchaseSkin(Skin1.Image, Skin1Text.Text)
  69.     EarnCashEvent:FireServer(DailySkin1.Price)
  70. end)
  71.  
  72. Skin2.MouseButton1Click:Connect(function()
  73.     PlayersCash = game.Players.LocalPlayer.PlayerValues.Cash.Value
  74.     if PlayersCash <= SkinsModule.MBGuy.Price then return end
  75.     PurchaseSkin(Skin2.Image, Skin2Text.Text)
  76.     EarnCashEvent:FireServer(DailySkin2.Price)
  77. end)
  78.  
  79. Skin3.MouseButton1Click:Connect(function()
  80.     PlayersCash = game.Players.LocalPlayer.PlayerValues.Cash.Value
  81.     if PlayersCash <= SkinsModule.MBGirl.Price then return end
  82.     PurchaseSkin(Skin3.Image, Skin3Text.Text)
  83.     EarnCashEvent:FireServer(DailySkin3.Price)
  84. end)
  85.  
  86.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement