Why doesnt cframe work in this script

local CollectionService = game:GetService(“CollectionService”)

for _, part in pairs(CollectionService:GetTagged(“paper”)) do
if part:IsA(“BasePart”) then
part.CFrame = part.CFrame * CFrame.new(0,0,-0.125) – you can ignore all this after this point
part.Color = Color3.fromRGB(math.random(1,255), math.random(1,255), math.random(1,255))
if part.Orientation == Vector3.new(0, -90, -90) then
part.Orientation = Vector3.new(math.random(-10,10), -90, -95)
else
part.Orientation = Vector3.new(-95, -90, math.random(-10,10))
end
end
end

Can you elaborate on what the problem is? That code seems to be working fine for me.
Does the part you want to move have the “paper” tag? Do the other lines of code changing the color and orientation run? Is this a local or server script?

local CollectionService = game:GetService("CollectionService")

for _, part in pairs(CollectionService:GetTagged("paper")) do
    if part:IsA("BasePart") then
        part.CFrame = part.CFrame * CFrame.new(0, 0, -0.125)
    end
end

Actually looks valid. This may be something other than this script.
Check if there are collisions with other parts or constraints applied.

1 Like