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

Help with basic Roblox rocket and CFrames?

local dir = vTarget - vHandle.Position

	dir = computeDirection(dir)

	local missile = Rocket:clone()

	local pos = vHandle.Position + (dir * 5)



	--missile.Position = pos
	missile.CFrame = CFrame.new(pos,  pos + dir)

This is code from the basic Roblox rocket. I understand most of how the rocket works, but this part has me lost. Can someone please explain what is going on in this chunk of code in English. For example, I don't know why they put "v" in front of Handle and Target. Why does the CFrame on the last line only have pos and pos + dir in the parenthesis - shouldn't there be three terms for the vector? Im just really stumped with this part of the code and I can't find anything explaining it.

1 answer

They are using their variable. Variables can be any name, like

sdfghujdrokfg = "hello"
dfdjcvhjdif93ews = "i am a variable"

One of their variables are vHandle, so they are using that variable.

Hope this helps!

1 comment

0

Well I'm still not sure about the CFrames, but I changed the variables around to my own parts and everything is working. Thx for explaining the variables. :)

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