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

Expected '(' when parsing function, got '=' ?

I need help figuring why this code is giving me an error.

local doors = game.Workspace.doors.Position

while true do
	wait(1)
	for i= 1, 400 do
		script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0, 0, 0.9)
		wait()
	end 
	wait(1)
	function doors = Vector3.new(-8.43, 42.84, 320.35)
	end 
end

Error:(line 8)

function doors = Vector3.new(-8.43, 42.84, 320.35)

1 answer

Put your code into lua block next time, click blue lua icon in post editor and put your code inside of these things


-- code

~~~~~~~~~~~

To your question, the reason why line 8 is erroring is because it makes no sense, you are doing

function doors = Vector3.new(-8.43, 42.84, 320.35) end

What is it supposed to do?
If you don't know how to create a function, you should read [this](https://developer.roblox.com/en-us/articles/Function), basically here is how to create a function

local function doors() -- use local variable there for little performance -- and what? Vector3.new? end

-- Call the function by doing doors() -- functions in roblox are called using brackets, inside of them you can put arguments that function might need

And you have a function. Or do you want to change the doors position? Then do

doors.Position = Vector3.new(-8.43, 42.84, 320.35)

Now you have set the doors position to Vector3 value. Or maybe you wanted to just create a local variable?

local doors = Vector3.new(-8.43, 42.84, 320.35)

Read about variables [here](https://developer.roblox.com/en-us/articles/Variables).

I don't really know what exactly are you trying to achieve with that line 8 but i guess this can help.



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