Advertisement
Sungmingamerpro13

PetEquip + Premium Pet

Mar 7th, 2023
865
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 1.87 KB | None | 0 0
  1. local repStorage = game:GetService("ReplicatedStorage")
  2. repStorage.Remotes.EquipPet.OnServerEvent:connect(function(plr, equip, pet)
  3.     if equip == 'Equip' then
  4.         for i,v in pairs(plr.Pets:GetChildren()) do
  5.             if v.Value == 'equipped' then
  6.                 v.Value = 'owned'
  7.             end
  8.         end
  9.         plr.Pets[pet].Value = 'equipped'
  10.         plr.Pets.CurrentPet.Value = pet
  11.         if plr.Character:FindFirstChild('Pet') then plr.Character.Pet:Destroy() end
  12.         if game.ServerStorage.Pets:FindFirstChild(pet) then
  13.             local a = game.ServerStorage.Pets[pet]:Clone()
  14.             a.Name = "Pet"
  15.             a.Parent = plr.Character
  16.         else
  17.         end
  18.     elseif equip == 'Unequip' then
  19.         for i,v in pairs(plr.Pets:GetChildren()) do
  20.             if v.Value == 'equipped' then
  21.                 v.Value = 'owned'
  22.             end
  23.         end
  24.         if plr.Character:FindFirstChild('Pet') then
  25.         plr.Character.Pet:Destroy()
  26.         plr.Pets.CurrentPet.Value = ''
  27.         else
  28.         plr.Pets.CurrentPet.Value = ''
  29.         end
  30.     end
  31. end)
  32.  
  33. repStorage.EquipPet.OnServerEvent:Connect(function(plr, equip, pet)
  34.     if equip == 'Equip' then
  35.         for i,v in pairs(plr.Pets:GetChildren()) do
  36.             if v.Value == 'equipped' then
  37.                 v.Value = 'owned'
  38.             end
  39.         end
  40.         plr.Pets[pet].Value = 'equipped'
  41.         plr.Pets.CurrentPet.Value = pet
  42.         if plr.Character:FindFirstChild('Pet') then plr.Character.Pet:Destroy() end
  43.         if plr.MembershipType == Enum.MembershipType.Premium then
  44.             local Character = plr.Character
  45.  
  46.             if Character then
  47.                 local PremiumPet = game.ServerStorage.PremiumPet:FindFirstChild("Premium Pet"):Clone()
  48.                 PremiumPet.Name = "Pet"
  49.                 PremiumPet.Parent = Character
  50.             end
  51.         end
  52.        
  53.     elseif equip == 'Unequip' then
  54.         for i,v in pairs(plr.Pets:GetChildren()) do
  55.             if v.Value == 'equipped' then
  56.                 v.Value = 'owned'
  57.             end
  58.         end
  59.         if plr.Character:FindFirstChild('Pet') then
  60.             plr.Character.Pet:Destroy()
  61.             plr.Pets.CurrentPet.Value = ''
  62.         else
  63.             plr.Pets.CurrentPet.Value = ''
  64.         end
  65.     end
  66. end)
Tags: Roblox
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement