Attempting to set an objects CFrame not working at all

Problem feels really simple, but I’ve tried many things and none of them have worked.


(In case the video doesnt load, Its a video of a block straight out of Insert Object. Its Anchored and its CFrame is set to -170, 10, -76. I attempt to run this specific code:

local RS = game:GetService("RunService")
RS.Heartbeat:Wait()
--Saw that one thing that could help is waiting for physics to start by
--waiting for a heartbeat. And no this does not infinitely yield.
local objRotation = script.Parent.Rotation
local objCFrame = script.Parent.CFrame

local newCFrame = CFrame.new(0,0,0)
objCFrame = newCFrame

But when the game runs, it does not get set to 0,0,0. It just stays at its orginal position.

Try creating a Vector3 instead of a CFrame

local newPosition = Vector3.new(0, 0, 0)

objCFrame = CFrame.new(newPosition)
1 Like

You are setting the variable to the CFrame, not the Parts CFrame:

script.Parent.CFrame = newCFrame
3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.