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

I keep getting the error "end:4: Expected function call arguments after '('". What?

while true do
	for _, v in pairs(game.Workspace:GetChildren()) do
		if v:WaitForChild("Part") or v.Name == "Part" then
		v:Destroy
	end	
end

This is a workspace cleaner. Every time it returns: end:4: Expected function call arguments after '(' What does this even mean?

2 comments

0

Use v:IsA(ClassName) instead of waiting for a child.

0

Yeah, i'll try that, (By the way, the aitforchild is to check if it is a model with parts inside)

1 answer

✓ Accepted answer

You are missing an end and the brackets of Destroy. Change your code to this:

while true do
    for _, v in pairs(game.Workspace:GetChildren()) do
        if v:WaitForChild("Part") or v.Name == "Part" then
        v:Destroy() -- You also need to add brackets.
		end
    end 
end

1 comment

0

Ah. Thank you! (I never thought old me would do such an error, and use waitforchild() not IsA())

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