Struggling to set visibility for attached object on player for specific players

Here is a quick walkthrough of what I am struggling with. Hopefully it is NOT to scatted...

[Here is an unlisted link a Community Project] (

Goal is for the power source orb to appear and disappear for each player when they enter the triggers or either player is killed. If we can do it without the tick... great, if not that is totally ok. Any help is massively appreciated. I have come at this from a lot of different angles and cannot get this working as intended in multiplayer needed. Thanks so much!

EDIT: Made it public in Community Editable Games as well.

So I had some amazing help from FleshyOverload on Discord and was able to solve. The issue was pretty much as follows which Fleshy outlined perfectly here....

The issue I see is that the "attachPowerOnLoad.lua" script only stores a reference to one instance of an "attachSpherePlayer" object. However, your code treats "attachSpherePlayer" as if it refers to each player's "attachSpherePlayer" object. If you wanted to do this, you would instead need to create a table of "attachSpherePlayer" with player objects or player ids as the keys for that table

...then the following was provided as a guide. I could not paste exactly which was great because it forced me to learn what was going on and get a nice intro to tables...

local BoxAssetID = [Asset ID of a Box object]
--Table containing the Box belonging to each player
local playerBoxes = {}

--Function Called whenever a player joins
function OnJoin(player)
  --Spawn a new Box object
  local boxInstance = World.SpawnAsset(BoxAssetID)
  --Store a reference to this player's box within the "playerObex" table
  playerBoxes[] = boxInstance
--Connect the "OnJoin" function to the "playerJoinedEvent"

--Function to be called every in game tick
function Tick(deltaTime)
  --Update the box visibility for each player.
  for _, player in ipairs(Game.GetPlayers()) do
    --If the player's score is 1 make the player's box visible
    if(player:GetResource("HasBox") == 1) then
      --Update the visibility of the current player's box
      playerBoxes[].visibility = Visibility.FORCE_ON
    --If the player's score is 0 make the player's box invisible
    elseif(player:GetResource("HasBox") == 0) then
      --Update the visibility of the current player's box
      playerBoxes[].visibility = Visibility.FORCE_OFF

I have also published this to the link above and will leave it live for a little bit in case someone else can benefit.

@mtgman365 huge thanks for posting the answer as a followup. That helps a ton! Glad you found it. (FleshyOverlord is indeed awesome.)