Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

CFraming duplicates of body parts to the actual body parts which are anchored not working?

I'm trying to cframe bigger duplicates of anchored body parts to an anchored player, each part to the player's relative part, when the player is moving for some reason the duplicates are being cframed not where they should be, this is the code of a script that once it's being enabled inside of a player's character it will cause the duplicates of his body to be cframed on that player's body

if not script.Parent.Head:FindFirstChild("Ignore") then
    --Player = game.Players:GetPlayerFromCharacter(script.Parent)
	--if Player ~= nil then
	    local Children = script.Parent:GetDescendants()
	    local Parts = {}
	    for i = 1, #Children do
	        if Children[i]:IsA("BasePart") and Children[i].Name ~= "HumanoidRootPart" and not Children[i].Parent:IsA("Tool") then
	            Children[i].Anchored = true
	        end
	    end
	--end
	wait(1)
	local Locked = Instance.new("BoolValue", script.Parent)
	Locked.Name = "Locked"
	game:GetService("Debris"):AddItem(Locked,5)
    local Children = script.Parent:GetDescendants()
    local Parts = {}
    for i = 1, #Children do
        if Children[i]:IsA("BasePart") and Children[i].Name ~= "HumanoidRootPart" and not Children[i].Parent:IsA("Tool") then
            Children[i].Anchored = true
            local Clone = Children[i]:Clone()
            if Clone:FindFirstChild("Mesh") then Clone.Mesh.TextureId = "" end
            Clone.Name = "Ignore"
			local Locked = Instance.new("BoolValue", Clone)
			Locked.Name = "Glacius"
            Clone.Material = Enum.Material.Ice
            Clone.BrickColor = BrickColor.new("Baby blue")
            Clone.Size = Children[i].Size + Vector3.new(.1, .1, .1)
            Clone.CanCollide = false
            Clone.Transparency = 0.6
            Clone.Parent = Children[i]
            table.insert(Parts, Clone)
        end
    end
    wait(5)
    for i = 1, #Parts do    
        if Parts[i].Parent ~= nil then
	        Parts[i].Parent.Anchored = false
			if Parts[i].Name ~= "Ignore" then 
	       		Parts[i].Parent.Transparency = 0
			end
		end
		Parts[i]:Destroy()
    end
    --Player = game.Players:GetPlayerFromCharacter(script.Parent)
	--if Player ~= nil then
	    local Children = script.Parent:GetDescendants()
	    local Parts = {}
	    for i = 1, #Children do
	        if Children[i]:IsA("BasePart") and Children[i].Name ~= "HumanoidRootPart" and not Children[i].Parent:IsA("Tool") then
	            Children[i].Anchored = false
	        end
	    end
	--end
end
wait()
script:Destroy()

1 comment

0

I don't know if this would work, but maybe cloning the players character, moving all the positions to your desire. And giving the regular player a transparency until the clones movement is final?

1 answer

I've fixed it, I just used a player variable and used DevComputerMovementMode to stop it from moving, and then cframed the parts on him after a small delay of some seconds.

This discussion is preserved as it was. New answers, comments, and votes are closed.