If when running a query similar to below you get an error stating that the hasLinks() function cannot be found.
This is because inside of ScriptRunner for Jira Cloud the hasLinks function is a JQL alias as described in the documentation page here.
As it is a JQL Alias you do not provide the issueFunction in part of it and the documentation page above shows how to run a query using the hasLinks JQL Alias inside of Jira Cloud.
An exampe of how to use the hasLinks function is shown below for reference purposes.
We can also confirm that you can see more detailed information on the differences between the cloud and server versions inside of our documentation page located here.