Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local repStorage = game:GetService("ReplicatedStorage")
- repStorage.Remotes.EquipPet.OnServerEvent:connect(function(plr, equip, pet)
- if equip == 'Equip' then
- for i,v in pairs(plr.Pets:GetChildren()) do
- if v.Value == 'equipped' then
- v.Value = 'owned'
- end
- end
- plr.Pets[pet].Value = 'equipped'
- plr.Pets.CurrentPet.Value = pet
- if plr.Character:FindFirstChild('Pet') then plr.Character.Pet:Destroy() end
- if game.ServerStorage.Pets:FindFirstChild(pet) then
- local a = game.ServerStorage.Pets[pet]:Clone()
- a.Name = "Pet"
- a.Parent = plr.Character
- else
- end
- elseif equip == 'Unequip' then
- for i,v in pairs(plr.Pets:GetChildren()) do
- if v.Value == 'equipped' then
- v.Value = 'owned'
- end
- end
- if plr.Character:FindFirstChild('Pet') then
- plr.Character.Pet:Destroy()
- plr.Pets.CurrentPet.Value = ''
- else
- plr.Pets.CurrentPet.Value = ''
- end
- end
- end)
- repStorage.EquipPet.OnServerEvent:Connect(function(plr, equip, pet)
- if equip == 'Equip' then
- for i,v in pairs(plr.Pets:GetChildren()) do
- if v.Value == 'equipped' then
- v.Value = 'owned'
- end
- end
- plr.Pets[pet].Value = 'equipped'
- plr.Pets.CurrentPet.Value = pet
- if plr.Character:FindFirstChild('Pet') then plr.Character.Pet:Destroy() end
- if plr.MembershipType == Enum.MembershipType.Premium then
- local Character = plr.Character
- if Character then
- local PremiumPet = game.ServerStorage.PremiumPet:FindFirstChild("Premium Pet"):Clone()
- PremiumPet.Name = "Pet"
- PremiumPet.Parent = Character
- end
- end
- elseif equip == 'Unequip' then
- for i,v in pairs(plr.Pets:GetChildren()) do
- if v.Value == 'equipped' then
- v.Value = 'owned'
- end
- end
- if plr.Character:FindFirstChild('Pet') then
- plr.Character.Pet:Destroy()
- plr.Pets.CurrentPet.Value = ''
- else
- plr.Pets.CurrentPet.Value = ''
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement