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:GetDescendants() --:GetChildren()
- for i,v in pairs(MainFrame:GetDescendants())do
- if v:IsA("ImageButton") and v.Name == "PetsButton" then
- for i,p in ipairs(PetValues)do
- v.MouseButton1Down:Connect(function()
- local function RunTest()
- if p:IsA("BoolValue") and v:FindFirstChild("PetIndex").Value and v:FindFirstChild("PetIndex").Value == p.Name then
- if debounce and player then
- debounce = false
- --local PetIsName = v:FindFirstChild("PetIndex").Value
- if p.Value == false and v:FindFirstChild("PetIndex").Value and v:FindFirstChild("PetIndex").Value == p.Name and player.leaderstats.Coins.Value >= v.Price.Value then
- --and v:FindFirstChild("PetIndex").Value == p.Name -- and p[PetIsName] and p.Name == PetIsName
- 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(v:FindFirstChild("PetIndex").Value .. " v - first if statement")
- -- print(p.Name .. " p.Name - 1st if statement")
- -- print(p.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
- debounce = true
- end
- if p.Value == false and v:FindFirstChild("PetIndex").Value and v:FindFirstChild("PetIndex").Value == p.Name and player.leaderstats.Coins.Value < v.Price.Value then -- and PetIsName
- v.PetPriceCheck.Text = "Not Enough Coins"
- wait(0.5)
- v.PetPriceCheck.Text = v.Price.Value .. " Coins" -- resets the price to its default per pet
- -- print(p.Name .. " p.Name - second if statement")
- -- print(v:FindFirstChild("PetIndex").Value .. " v - second if statement")
- -- print(p.Value)
- debounce = true
- end
- if p.Value == true then --and v:FindFirstChild("PetIndex").Value == p.Name and player.leaderstats.Coins.Value >= v.Price.Value or player.leaderstats.Coins.Value < v.Price.Value then
- -- print(p.Name .. " p.Name - Third if statement")
- -- print(v:FindFirstChild("PetIndex").Value .. " v - Third if statement")
- -- print(p.Value)
- print("We own the pet firing remote event")
- debounce = true
- end
- debounce = true
- end
- end
- wait()
- --break
- end
- RunTest()
- end)
- end
- 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