#Clones not having r15 movement and just gliding

17 messages · Page 1 of 1 (latest)

woven socket
#

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
neat lagoon
#

Okay so first thing you wanna do

#

Is give up scripting and become a modeler instead

woven socket
#

no

#

I'm getting paid 2 robux

neat lagoon
#

Wowie

woven socket
#

Yippe I fixed the script

slender dust
woven socket
# slender dust BodyPosition and BodyGyro are deprecated (outdated and replaced)

local RunService = game:GetService("RunService")

local GlobalCache = {}

local Offset = 2

local function CreateNPCS(Character : Model, Amount : number)
    
    local TemporaryCache = {}
    
    Character.Archivable = true
    
    local CharacterPivot = Character:GetPivot()
    local CharacterSize = Character:GetExtentsSize()
    
    for i = 1, Amount do
        
        local NewClone = Character:Clone()
        NewClone.Parent = workspace
        NewClone:PivotTo(CharacterPivot * CFrame.new(0, 0, i * (CharacterSize.Z + Offset)))
        
        TemporaryCache[i] = NewClone
        
    end
    
    Character.Archivable = false
    
    return TemporaryCache
    
end

local function OnTouched(hit)
    local Character = hit.Parent
    local Player = game.Players:GetPlayerFromCharacter(Character)

    if Player and not GlobalCache[Character] then
        GlobalCache[Character] = CreateNPCS(Character, 10)
    end
end

local function Update(DeltaTime : number)
    
    for Character, Cache in GlobalCache do

        if Character.Humanoid.MoveDirection.Magnitude == 0 then
            continue
        end
        
        local CharacterPivotPosition = Character:GetPivot().Position
        local CharacterSize = Character:GetExtentsSize()
        
        for Index, Clone : Model in Cache do
            
            local NextInLine = Cache[Index - 1] -- Fixing the NextInLine logic
            
            if not NextInLine then
                Clone.Humanoid:MoveTo(CharacterPivotPosition)
            else
                Clone.Humanoid:MoveTo(NextInLine:GetPivot().Position)
            end
            
        end
        
    end 
    
end

RunService.Heartbeat:Connect(Update)
TouchPart.Touched:Connect(OnTouched)```
Fixed script but now it doesn't have r15 walk and just glides
woven socket
#

Clones not having r15 movement and just gliding

woven socket
#

local SimpleAnimate = require(...)

local r6 = SimpleAnimate.getCopyOfAnimsList("R6", "Animations")
local controller = SimpleAnimate.new(script.Parent) -- if the parent is the npc

woven socket
woven socket