Im trying to cframe every part in workspace except player bodyparts, but it doesnt seem to be working. Whenever i execute it, it cframes the bodyparts too even tho its not supposed to.

Heres the script:

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 -- The part that doesnt work
            v.CFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame
        end
    end
end

Any idea on how to fix this?

1 comment

0

Can someone answer please?