Skript

Skript

743k Downloads

Teleport effect breaks function's return

x8ight opened this issue ยท 2 comments

commented

Skript/Server Version

Server Version: 1.21.1-122-4430e96 (MC: 1.21.1)

Skript Version: 2.9.3 (skriptlang-github)

Installed Skript Addons:
- skript-particle v1.3.1 (https://github.com/sovdeeth/skript-particle)
- skript-reflect v2.5.1 (https://github.com/SkriptLang/skript-reflect)
- SkBee v3.6.1 (https://github.com/ShaneBeee/SkBee)

Bug Description

Using the teleport effect in a function makes Skript think a return statement cannot be used.

Error: The return effect can only be used in functions, custom expressions, sections, custom syntax parse sections and conditions

Expected Behavior

Expected the teleport effect to teleport the entity, then the function to return the string.

Steps to Reproduce

Using the teleport effect inside of a function, followed by a return generates this issue. The following boiled-down code still yields the error, commenting out line 2 lets the script reload with no errors.

local function what() :: string:
  teleport {_noOne} to {_nowhere}
  return "Why?"

Errors or Screenshots

Screenshot 2024-10-14 at 7 30 18 PM Screenshot 2024-10-14 at 7 46 55 PM

Other

Uninstalling skript-reflect changes the error message (2nd screenshot). However this function does not have a delay at all.

Agreement

  • I have read the guidelines above and affirm I am following them with this report.
commented

duplicate of #6444

commented

to explain, the delay error is intentional because the teleport effect may have to wait for a chunk to load. If you want to use teleport in your function, use the force teleport option. Beware this may cause lag when teleporting to unloaded chunks.