Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local PETS_LIST = require(game.ReplicatedStorage.PETS_LIST)
- local function CREATE_MOVERS(PET)
- local POS = Instance.new("BodyPosition")
- local GYR = Instance.new("BodyGyro")
- POS.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
- POS.P = 1000
- POS.D = 200
- GYR.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
- GYR.P = 1000
- GYR.D = 100
- POS.Parent = PET
- GYR.Parent = PET
- end
- local function CREATE_NEW(CHAR, NAME, PLAYER)
- if game.ServerStorage.PETS:FindFirstChild(NAME) then
- local NEW = game.ServerStorage.PETS:FindFirstChild(NAME):Clone()
- NEW.CFrame = CHAR.Head.CFrame + Vector3.new(1, 0, 2)
- NEW.Parent = CHAR
- NEW:SetNetworkOwner(PLAYER)
- CREATE_MOVERS(NEW)
- return NEW
- end
- end
- game.Players.PlayerAdded:Connect(function(PLAYER)
- local EQUIPPED_PET = Instance.new("StringValue")
- EQUIPPED_PET.Name = "EQUIPPED_PET"
- EQUIPPED_PET.Parent = PLAYER
- EQUIPPED_PET.Changed:Connect(function(NAME)
- if NAME ~= "" then
- for _, v in pairs(PLAYER.Character:GetChildren()) do
- if v:IsA("BasePart") then -- // PUT MODEL IF YOUR PET IS A MODEL. MINE IS A BASEPART
- if table.find(PETS_LIST, v.Name) then
- v:Destroy()
- end
- end
- end
- local NEW_PET = CREATE_NEW(PLAYER.Character, NAME, PLAYER)
- else
- for _, v in pairs(PLAYER.Character:GetChildren()) do
- if v:IsA("BasePart") then -- // PUT MODEL IF YOUR PET IS A MODEL. MINE IS A BASEPART
- if table.find(PETS_LIST, v.Name) then
- v:Destroy()
- end
- end
- end
- end
- end)
- end)
Add Comment
Please, Sign In to add comment