I made a script when someone touches an orb it'll make a clone and I told gpt to make it so the clones will follow the person that made the clone.
orb.Touched:Connect(function(hit)
local character = hit.Parent
local player = game.Players:GetPlayerFromCharacter(character)
if player then
character.Archivable = true
local clone = character:Clone()
clone.Parent = game.Workspace
clone.Name = player.Name .. "_Clone"
local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
local cloneRootPart = clone:FindFirstChild("HumanoidRootPart")
if humanoidRootPart and cloneRootPart then
local behindPosition = humanoidRootPart.Position - humanoidRootPart.CFrame.LookVector * 3
clone:SetPrimaryPartCFrame(CFrame.new(behindPosition) * humanoidRootPart.CFrame.Rotation)
local cloneHumanoid = clone:FindFirstChildOfClass("Humanoid")
if cloneHumanoid then
cloneHumanoid:Destroy()
end
local bodyPosition = Instance.new("BodyPosition")
bodyPosition.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
bodyPosition.P = 5000
bodyPosition.Parent = cloneRootPart
local bodyGyro = Instance.new("BodyGyro")
bodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
bodyGyro.P = 5000
bodyGyro.Parent = cloneRootPart
task.spawn(function()
while clone and clone.Parent and humanoidRootPart and humanoidRootPart.Parent do
bodyPosition.Position = humanoidRootPart.Position - humanoidRootPart.CFrame.LookVector * 3
bodyGyro.CFrame = humanoidRootPart.CFrame
task.wait(0.1)
end
end)
end
end
end)```
If someone wants to help or improve my script feel free