Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local RS = game:GetService("ReplicatedStorage") -- the actual Service in what we have all the Pets,Events stored and etc.
- local PetsFolder = RS.Pets
- local PetsFrameEvent = PetsFolder.PetEvents.PetFrame -- the event that we need for the purchase frame to pop up
- local HiddenPetEvent = PetsFolder.PetEvents.HiddenPetEvent
- local MainFrame = script.Parent -- the frame that we will use to loop and get all objects,("instances") from!!!
- 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!!
- local player = game:GetService("Players").LocalPlayer -- thats a easy way of getting the local Player
- local PetValues = player.PetsFolder.Values:GetChildren()
- for i,v in pairs(MainFrame:GetDescendants())do
- if v:IsA("ImageButton") and v.Name == "PetsButton" then
- v.MouseButton1Down:Connect(function()
- local function RunTest()
- for i,p in ipairs(PetValues)do
- --print(p)
- -- print(p.Value)
- if p:IsA("BoolValue") then
- if debounce and player then
- debounce = false
- local PetIsName = v:FindFirstChild("PetIndex").Value
- --print(PetIsName)
- -- p = PetIsName
- -- print(p)
- -- print(p.Value)
- --print(p.Name)
- 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
- --print(p.Name)
- local Frame = player:FindFirstChild("PlayerGui"):FindFirstChild("PetsPurchaseGui"):FindFirstChild("BuyPet")
- local FrameInfo = Frame:FindFirstChild("Desc")
- local PetName = v:FindFirstChild("PetIndex").Value
- local PetPrice = v:FindFirstChild("Price").Value
- --print(PetName)
- print(v:FindFirstChild("PetIndex").Value)
- FrameInfo.Text = "Are you Sure you want to buy this " .. PetName .. " for " .. PetPrice .. " Coins"
- Frame:TweenPosition(
- UDim2.new(0.499, 0,0.494, 0),-- End Position
- "Out", -- Easing Direction
- "Linear", -- Easing Style
- .5 -- Time in Seconds
- )
- Frame.Visible = true
- elseif p.Value == false and v:FindFirstChild("PetIndex").Value and player.leaderstats.Coins.Value < v.Price.Value then -- and PetIsName
- v.PetPriceCheck.Text = "Not Enough Coins"
- wait(1)
- v.PetPriceCheck.Text = v.Price.Value .. " Coins" -- resets the price to its default per pet
- debounce = true
- -- print(p.Name)
- -- break
- 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
- -- print(p.Name)
- print("We own the pet firing remote event")
- -- break
- end
- debounce = true
- end
- end
- wait()
- --break
- end
- end
- RunTest()
- --return
- end)
- --wait(1)
- end
- if v:IsA("ImageButton") and v.Name == "PetsGamepassButton" then -- gamepass experiment stuff
- --print("not my nigga") -- script will run when player is loaded basically the for loop:)
- v.MouseButton1Down:Connect(function()
- if debounce and player then
- print("not my nigga")
- end
- end)
- end
- if v:IsA("ImageButton") and v.Name == "PetsHiddenButton" then -- gamepass experiment stuff
- --print("not my nigga") -- script will run when player is loaded basically the for loop:)
- v.MouseButton1Down:Connect(function()
- if debounce and player then
- -- if stat bla bla = true then do this bam
- print("not my hidden nigga")
- end
- end)
- end
- end
Add Comment
Please, Sign In to add comment