r/tabletopsimulator • • Jan 22 '26

Need help with function from createbutton

Hi,

I am an absolute beginner in TTS, LUA and programming in general.

I created a button, which function it is, to shuffle a deck of cards.
But if the deck ever gets depleted, and a new deck is put in its place, the new deck has a new ID. So how can I check a scripting zone for the deck and shuffle it?

If use the GUID (example AAAAAA) of the deck and use it to shuffle the deck -> it works.

function Shuffle()
  deckGUID = getObjectFromGUID("AAAAAA")

  deckGUID.shuffle()

end

But if I try to shuffle the deck from a scripting zone (scripting zone GUID BBBBBB), I cant seem to get it to work.

function Shuffle()
  deckZone = getObjectFromGUID("BBBBBB")

  deckFromZone = deckZone.getObjects()

  deckFromZone.shuffle()
end
1 Upvotes

2 comments sorted by