Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- 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
- 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),
- "Out",
- "Linear",
- .5
- )
- Frame.Visible = true
- wait(.5)
- debounce = true
- BuyButton.MouseButton1Down:Connect(function()
- print(v:FindFirstChild("PetIndex").Value .. " v - first if statement")
- print(p.Name .. " p.Name - 1st if statement")
- print(p.Value)
- end)
- 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
- v.PetPriceCheck.Text = "Not Enough Coins"
- wait(0.5)
- v.PetPriceCheck.Text = v.Price.Value .. " Coins"
- debounce = true
- end
- if p.Value == true then
- PetsPurchaseEvent:FireServer(player,p)
- print("We own the pet firing remote event")
- debounce = true
- end
- debounce = true
- end
- end
- wait()
- end
- RunTest()
- end)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement