Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
Edited 4 years ago
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

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. Dovydas1118 1495 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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

Ad
Log in to vote
0
Answered by
Benbebop 1049 Moderation Voter
4 years ago
Edited 4 years ago

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.

0
Nice answer Killerbot712 47 — 4y
0
my words exactly. But way better Killerbot712 47 — 4y

Answer this question