local CurrentPets = {}
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local RS = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local Template = Instance.new("Part")
Template.Size = Vector3.new(2,2,2)
Template.Anchored = true
Template.CanCollide = false
UIS.InputBegan:Connect(function(key,proc)
if not proc then
if key.KeyCode == Enum.KeyCode.Y then
local Pet = Template:Clone()
Pet.Parent = workspace
table.insert(CurrentPets,Pet)
end
end
end)
RS.RenderStepped:Connect(function()
local Deg = (math.pi*2)/#CurrentPets
local SubI = 1
for i,v in pairs(CurrentPets) do
if SubI > 3 then
SubI = 1
end
local Row = math.floor(i/3)
local CF = Character.PrimaryPart.CFrame * CFrame.new(-6 + (3*SubI),0,(3*Row)+3)
v.CFrame = v.CFrame:Lerp(CF,0.1)
SubI += 1
end
end)
Here’s the problem:
For some reason the third pet goes back