Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

For looping parts not working properly?

Asked by 3 years ago

Hello, so this script should have worked properly but im having problem with names. So i made a quick thing to show as an example.. The names arent working properly. So what it's supposed to do is cframe every part besides character bodyparts to HumanoidRootPart cframe but the issue is that it cframes the bodyparts too.

How can i fix this:

local CharacterBodyParts = {}

for i,v in next, game:GetService("Players"):GetPlayers() do
    for _,x in next, v.Character:GetChildren() do
        if x:IsA("BasePart") or x:IsA("MeshPart") then
            table.insert(CharacterBodyParts, x.Name)
        end
    end
end

for i,v in next, workspace:GetDescendants() do
    for _,x in next, CharacterBodyParts do
        if v:IsA("BasePart") and tostring(v.Name) ~= x then
            v.CFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame
        end
    end
end

Any help is appreciated.

0
Are you trying to teleport the player's character? MarkedTomato 810 — 3y
0
No im trying to teleport every part in workspace except player's bodyparts RemsFriend -24 — 3y
0
Can someone answer please? RemsFriend -24 — 3y

Answer this question