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

For looping every part in workspace except player bodyparts not working?

Asked by 3 years ago

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?

0
Can someone answer please? RemsFriend -24 — 3y

Answer this question