New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Still have questions? Join our Discord server and get real time help.
0

# Changing an anonymous function into a regular one gives me an error?

Edited 10 days ago

So I am making my customizable and editable admin commands and the way I do it is by anonymous functions. However I always want there be a way to get a player or a team so I turn them back to regular functions but that gives me an error.

The error is:

CommandsModuleScript:106: Expected '(' when parsing function, got 'GetPlayer'

Here's the anonymous function that was correct back then:

function(PlayerChatted, ReformedSplices) --
print("Executed")
if TeamsService:FindFirstChild(ReformedSplices[1]) then
return {TeamsService:FindFirstChild(ReformedSplices[1])}
end
return nil
end,


Here's the regular function that is somehow incorrect:

function GetPlayer(PlayerChatted, ReformedSplices) -- error happens here
print("Executed")
if TeamsService:FindFirstChild(ReformedSplices[1]) then
return {TeamsService:FindFirstChild(ReformedSplices[1])}
end
return nil
end,


The functions both have other anonymous functions above them inside of a table to keep things organized but I'm not sure why it causes that error. The error seems like it wants to become an anonymous function but I'm not too sure.

2
Have you tried GetPlayer = function(PlayerChatted, ReformedSplices)? y3_th 130 — 10d
0
yup it worked! post this as an answer so you can get the reward and other people won't come to the question anymore 123nabilben123 340 — 10d