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 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
- for i,v in pairs(MainFrame:GetDescendants())do
- if v:IsA("ImageButton") and v.Name == "PetsButton" then -- checks if theres a image button and its name is equal to "PetsButton"
- v.MouseButton1Down:Connect(function() -- this function will fire if the requirments above are true!!
- if debounce and Player then -- check if debounce is true theres a player , this is optimal tho,not nessesary
- if Player.leaderstats.Coins.Value >= v.Price.Value then -- checks if the player has Coins
- debounce = false
- print("hi my nigga")
- wait(.1)
- PetsFrameEvent:FireServer() -- Fires from client to server to check if the player owns the pet or not:P
- debounce = true
- else -- if player doesnt have enough Coins then the RemoteEvent above wont execute and this will!!
- v.PetPriceCheck.Text = "Not Enough Coins"
- wait(1)
- v.PetPriceCheck.Text = v.Price.Value .. " Coins" -- resets the price to its default per pet
- end
- 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()
- print("not my nigga")
- end)
- end
- end
Add Comment
Please, Sign In to add comment