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

Workspace.Me.Script:15: Expected 'then' when parsing if statement, got 'end'???

This will help you understand:

I am trying to make a script that will get string values or the name of the value from a custom database. and if the action happens from my script you will see printed output.

Problem:

Every single time i see this error: Workspace.Me.Script:15: Expected 'then' when parsing if statement, got 'end'

My code:

function Input_is_Action(Input,ImportName,Output)
	for i,things in pairs(script.Parent.Database:GetChildren()) do
		if Input.ImportName:Connect(function(hitname)
				if hitname.Name == things.Value or things.Name then
					print("Object in database found!")
					print("Now doing Action:")
					print(Output)
					wait(0.1)	
					
				else
					print("Nothing Found!")
				end				
			end)
				
	end


Input_is_Action(workspace.Start,Touched(),"point")

is there a reason why i get the Error? if so how would i fix it?

1 answer

✓ Accepted answer

On your 3rd line, you put an if statement that was not needed at all. if Input.ImportName:Connect(function(hitname)

Functions do not use an if statement to work, whether this was an accident or not I just want to make sure you understand the problem.

2 comments

0

Correct, just use Input.ImportName:Connect(function(hitname)

0

Thx 8oe&krowten024nabrU

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