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

CFrame Script, It didn't work and i'm guessing i made it wrong?

So, i was trying to create a sign that swayed and moves like a animation, kind of smoothly, so i created the part and made it move smoothly, but it won't run. what did i do wrong?

I also wanted it to rotate. but it didn't move, didn't rotate. nothing. Script V

local Signsway = script.Parent
signsway.CFrame.new.Vector3(10,0,0)
while true do
	CFrame.new.Vector3(10,0,0)
	CFrame.new.Vector3(5,0,0)
	CFrame.new.Vector3(0,0,0)
	CFrame.new.Vector3(-5,0,0)
	CFrame.new.Vector3(-10,0,0)
end

1 comment

0

maybe do signsway.Rotation = Vector3.new(#, #, #)

2 answers

You just gave me the biggest damn headache ever.

local Signsway = script.Parent
signsway.CFrame = CFrame.new(10,0,0)
while true do
	wait()
	signsway.CFrame = CFrame.new(10,0,0)
	wait()
	signsway.CFrame = CFrame.new(5,0,0)
	wait()
	signsway.CFrame = CFrame.new(0,0,0)
	wait()
	signsway.CFrame = CFrame.new(-5,0,0)
	wait()
	signsway.CFrame = CFrame.new(-10,0,0)
end

1, You need to visit the wiki 2, You need to learn how to script properly, 3, You cant set a cframe by using cframe.new.vector3() 4,This isnt smooth one bit, your jumping from 10 - 10 in a split seccond. 5, Try out lerp 6, I now need to get off, go to the hospital and get my head checked after reading this, thanks a lot. Luckily i live in Canada.

The problem is you're using the CFrame wrong. To rotate a part, use CFrame.Angles

Example:

local Signsway = script.Parent
Signsway.CFrame = CFrame.Angles(10,0,0)
while true do
	Signsway.CFrame = CFrame.Angles(10,0,0)
	Signsway.CFrame = CFrame.Angles(5,0,0)
	Signsway.CFrame = CFrame.Angles(0,0,0)
	Signsway.CFrame = CFrame.Angles(-5,0,0)
	Signsway.CFrame = CFrame.Angles(-10,0,0)
	wait()
end

For more information on CFrames, go to http://wiki.roblox.com/index.php?title=CFrame

2 comments

0

Also don't forget your wait in the while true do loop.

0

gg

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