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

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

Asked by 4 years ago
Edited 4 years ago

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

Log in to vote
3
Answered by
8oe 115 Donator
4 years ago

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.

0
Correct, just use `Input.ImportName:Connect(function(hitname)` krowten024nabrU 463 — 4y
0
Thx 8oe&krowten024nabrU Retallack445 75 — 4y
Ad

Answer this question