qsenko1

working test pet shop protytipe lol

Jun 25th, 2021
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.73 KB | None | 0 0
  1. local RS = game:GetService("ReplicatedStorage") -- the actual Service in what we have all the Pets,Events stored and etc.
  2. local PetsFolder = RS.Pets
  3. local PetsFrameEvent = PetsFolder.PetEvents.PetFrame -- the event that we need for the purchase frame to pop up
  4. local HiddenPetEvent = PetsFolder.PetEvents.HiddenPetEvent
  5. local MainFrame = script.Parent -- the frame that we will use to loop and get all objects,("instances") from!!!
  6. local debounce = true -- debounce is not recommended it can be just debounce that means its either true or false but i love setting it to something!!
  7. local player = game:GetService("Players").LocalPlayer -- thats a easy way of getting the local Player
  8. local PetValues = player.PetsFolder.Values:GetChildren()
  9.  
  10. for i,v in pairs(MainFrame:GetDescendants())do
  11.     if v:IsA("ImageButton") and v.Name == "PetsButton" then    
  12.         v.MouseButton1Down:Connect(function()          
  13.             local function RunTest()
  14.             for i,p in ipairs(PetValues)do                                 
  15.           --print(p)
  16.         --  print(p.Value)     
  17.         if p:IsA("BoolValue") then     
  18.             if debounce and player then    
  19.                debounce = false
  20.                local PetIsName = v:FindFirstChild("PetIndex").Value                                                                                                                            
  21.                     --print(PetIsName)
  22.                 --  p = PetIsName
  23.             --      print(p)
  24.                     --  print(p.Value)
  25.                    --print(p.Name) 
  26.                 if p.Value == false and v:FindFirstChild("PetIndex").Value and player.leaderstats.Coins.Value >= v.Price.Value then --and v:FindFirstChild("PetIndex").Value == p.Name-- and p[PetIsName] and p.Name == PetIsName
  27.                     --print(p.Name)    
  28.                     local Frame = player:FindFirstChild("PlayerGui"):FindFirstChild("PetsPurchaseGui"):FindFirstChild("BuyPet")    
  29.                     local FrameInfo = Frame:FindFirstChild("Desc")
  30.                     local PetName = v:FindFirstChild("PetIndex").Value
  31.                     local PetPrice = v:FindFirstChild("Price").Value           
  32.                   --print(PetName)
  33.                     print(v:FindFirstChild("PetIndex").Value)          
  34.                     FrameInfo.Text = "Are you Sure you want to buy this " .. PetName .. " for " .. PetPrice .. " Coins"        
  35.                     Frame:TweenPosition(
  36.                         UDim2.new(0.499, 0,0.494, 0),-- End Position       
  37.                         "Out", -- Easing Direction
  38.                         "Linear", -- Easing Style
  39.                         .5 -- Time in Seconds
  40.                     )  
  41.                        Frame.Visible = true                        
  42.                 elseif p.Value == false and v:FindFirstChild("PetIndex").Value and player.leaderstats.Coins.Value < v.Price.Value then -- and PetIsName                              
  43.                        v.PetPriceCheck.Text = "Not Enough Coins"
  44.                        wait(1)
  45.                        v.PetPriceCheck.Text = v.Price.Value .. " Coins" -- resets the price to its default per pet                                                             
  46.                        debounce = true 
  47.                        -- print(p.Name)
  48.                       -- break
  49.                 elseif p.Value == true and v:FindFirstChild("PetIndex").Value and player.leaderstats.Coins.Value >= v.Price.Value or player.leaderstats.Coins.Value < v.Price.Value then                       
  50.                     --   print(p.Name)     
  51.                        print("We own the pet firing remote event") 
  52.                       -- break 
  53.                     end            
  54.                     debounce = true        
  55.                 end                                        
  56.             end    
  57.                 wait() 
  58.                  --break
  59.                 end
  60.             end        
  61.             RunTest()  
  62.             --return
  63.         end)   
  64.         --wait(1)          
  65.     end
  66.  
  67.     if v:IsA("ImageButton") and v.Name == "PetsGamepassButton" then -- gamepass experiment stuff
  68.         --print("not my nigga") -- script will run when player is loaded basically the for loop:)
  69.         v.MouseButton1Down:Connect(function()
  70.             if debounce and player then        
  71.                 print("not my nigga")          
  72.             end
  73.         end)
  74.     end
  75.  
  76.     if v:IsA("ImageButton") and v.Name == "PetsHiddenButton" then -- gamepass experiment stuff
  77.         --print("not my nigga") -- script will run when player is loaded basically the for loop:)
  78.         v.MouseButton1Down:Connect(function()
  79.             if debounce and player then        
  80.                 -- if stat bla bla = true then do this bam
  81.                print("not my hidden nigga")        
  82.             end
  83.         end)
  84.     end
  85. end
Add Comment
Please, Sign In to add comment