Expected identifier when expresson, got 'then'

Hello!

So I’ve been getting this error and I have no idea how to fix it neither can I find another post similar to it.
If someone could help me out and solve this problem that would be nice!
Here’s the code:

while true do
	if script.Parent.Parent = game.Workspace then
		repeat
			script.Parent.Position = Vector3.new(script.Parent.Position.X, script.Parent.Position.Y + 1, script.Parent.Position.Z)
			wait(0.1)
		until script.Parent.Position.Y >= -47.405
if script.Parent.Parent = game.Workspace then

Should be

if script.Parent.Parent == game.Workspace then

== for comparision
= for assigning

Thank’s for helping out, I really appreciate it!

1 Like

Anytime! If you have anymore issues don’t be afraid to make another post!

Also I recommend you use workspace instead of game.Workspace as the former does t he same and is shorter and directly references the service instead of indexing it, which could cause problems if the service is renamed from the explorer!

Oh and please make a variable for script.Parent before the loop as you use it quite a lot!

Thanks again! I’ll make a variable and change game.Workspace to workspace.

1 Like