Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

why wont cframe and vector3 work in a loop?

local cf = workspace.bus.PrimaryPart.CFrame
local aa = 1

while wait(0.1)do
	if aa == 1 then
		repeat
			cf = cf + Vector3.new(1,0,0)
			wait(0.1)
		until
			cf == Vector3.new(-26.039, 8.275, 183.607)
		aa = 2
		wait(2)
		cf = cf + Vector3.new(1,0,0)
		aa = 1
	end
end

1 comment

0

I have know idea what you are trying to do. Can you give more detail?

1 answer

Next time explain in more depth like what does it do now and what do you want it do.

it doesnt work bc cf is the value of the cframe , when u do cf += Vector3.new(-26.039, 8.275, 183.607) it wont give that primarypart cframe that value but cr will have that value. cf doesnt hold a reference to that primary part but it holds the literally value so anything u do to cf wont affect the cframe of primary part. Comprendo ?

also use meaningfull names, instead of aa name it debounce and use a bool secondly

cf == Vector3.new(-26.039, 8.275, 183.607) this wont work either you cant compare a CFrame and a Vector3

This discussion is preserved as it was. New answers, comments, and votes are closed.