Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local RS = game:GetService("ReplicatedStorage")
- local PetsFolder = RS.Pets
- local PetsFrameEvent = PetsFolder.PetEvents.PetFrame
- local MainFrame = script.Parent
- local debounce = true
- local player = game:GetService("Players").LocalPlayer
- local PetValues = player.PetsFolder.Values:GetChildren()
- wait()
- 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)
- if p.Value == false and player.leaderstats.Coins.Value >= v.Price.Value then -- and p[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(PetName)
- 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 player.leaderstats.Coins.Value < v.Price.Value then
- v.PetPriceCheck.Text = "Not Enough Coins"
- wait(1)
- v.PetPriceCheck.Text = v.Price.Value .. " Coins"
- elseif p.Value == true and player.leaderstats.Coins.Value >= v.Price.Value or player.leaderstats.Coins.Value < v.Price.Value then
- print("We own the pet firing remote event")
- end
- debounce = true
- end
- end
- wait()
- --break
- end
- end
- RunTest()
- --return
- end)
- --wait(1)
- end
Add Comment
Please, Sign In to add comment