Page 1 of 1

How to get owner of construction robot?

Posted: Thu Aug 23, 2018 10:28 am
by darkfrei
Hi all! How to get the owner of the construction robot? Player index for personal roboport or nothing, if it was from standard roboport.

Re: How to get owner of construction robot?

Posted: Fri Nov 04, 2022 3:46 pm
by jodokus31
I stumbled over this, when searching an answer for this question.

My solution on this is now, that the robot has a force and not a unique owner.
So, the owners are all players of the force

Code: Select all

        local players = {}
        for _, player in pairs(game.players) do
        if player.force.name == robot.force.name then
          table.insert(players, player)
        end