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

for some reason then has a red underline!? What is wrong with my script?

local crusher = game.Workspace.Crusher.Crusher
if crusher.Position(Vector3.new(57.89, 12.335, 5.205) then
	crusher.Position(Vector3.new(57.89, -2.665, 5.205)
			end
		end)

for some reason "then" has a red underline

1 comment

0

I don't think anything is wrong with your script. Maybe remove the gaps on the end statements. Actually, remove the end) statement since you don't need it.

2 answers

Wouldn't you need to change

if crusher.Position(Vector3.new(57.89, 12.355, 5.204) then

To

if crusher.Position == Vector3.new(57.89, 12.355, 5.204)

and remove the end) since theres no event

#To directly answer your question

It is because crusher.Position(Vector3.new(57.89, 12.335, 5.205) does not have a second closing bracket.

#Long answer

I doubt this would do anything anyway. Its hard to tell what you are trying to do. I assume you want to move the crusher when it reaches a certain position. If so it should look like this:

local crusher = game.Workspace.Crusher.Crusher

if crusher.position == Vector3.new(57.89, 12.335, 5.205) then
	crusher.Position = Vector3.new(57.89, -2.665, 5.205)
end

#Lets break this down

if crusher.position == Vector3.new(57.89, 12.335, 5.205) then

this is how comparative statements should look, you have the first value (crusher.position) then a comparative operator (==) lastly the second value (Vector3.new(57.89, 12.335, 5.205)). This will only execute the code contained within it when value one is exactly equal to value two.

crusher.Position = Vector3.new(57.89, -2.665, 5.205)

this is how you set variables, you have your first value (crusher.Position) an equal sign and your second value that you will append to the first (Vector3.new(57.89, -2.665, 5.205)).

Though I'm not sure if this is the goal.

2 comments

0

Nice answer

0

my words exactly. But way better

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