Scripts don't resolve on player when in first person action camera

Describe the bug:

When playing in first person action camera, script references won’t resolve.

How do you cause this bug?

  • Create a new game
  • Add a script folder to the player
  • Add a script to the script folder called “fooScript”
  • add ascript to the player called “barScript”
  • Inside barScript, add the following:
local BarScript = {}

-- Script properties are defined here
BarScript.Properties = {
	-- Example property
	--{name = "health", type = "number", tooltip = "Current health", default = 100},

--This function is called on the server when this entity is created
function BarScript:LocalInit()

return BarScript
  • In the Player properties, set the Forced Camera Restriction to 1st person only
  • Preview the game, barScript will print nil

Screenshots / video of bug:

Which platform: PC

Your Crayta username: Cereal

Game seen in (including “Hub” or “Editor for XYZ”): Glum Chums, editor, every game. Just hit page up until you go into first person, then enter any game. Nothing will work.

How regularly do you see this? (E.g. 2/3 times - please try 3 times if possible): Every time.

Time + date seen: December 17 2022

Version number (found in Help tab in Settings): 0.i1.86.138001


Adding to say that this issue has existed since cybotanica and isn’t a camera or player specific issue. I think a recent update has increased the latency(3-4x) by enough to allow the proof of concept above to work reliably.
The issue can also be reproduced in Glum Chums(Game seen in) without switching to the first person camera.

The LocalInit entry point for an individual script can fire before all of the scripts on the entity have been initialized/exist, leading to a race condition.

In my (probably edge) case, LocalInit is unreliable to the point where I can’t use it.

Hey there @Cereal !

As Adam mentioned on our Discord they brought it to the Dev’s attentions.
I can also confirm that a ticket has been created for this issue.

Hoping this will get a fix for you soon! :slight_smile: