Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can you save an instance, it's children, and it's properties into one string or UTF-8 and then back?

Asked by
Jac_00b 157
3 years ago
Edited 3 years ago

This question has been solved by the original poster.

Hello, I want to save an instance and it's properties (like it's parent, a child's color, and other stuff like that) into a string or UTF-8 so I can use MessagingService to send it game-wide. Basically I want a GUI to be updated game-wide. The frame has some properties and children I want to cross over, but I'm not sure how I should do it. The code block is here:

local newidea = player.PlayerGui.Main.Scroll.Air:Clone()
newidea.Parent = player.PlayerGui.Request.Holder
newidea.TextButton.BackgroundColor3 = color
newidea.TextButton.Text = message
newidea.ele1.Value = ele11
newidea.ele2.Value = ele22
newidea.ID.Value = #game.ReplicatedStorage.ServerScroll:GetChildren() + 1
local newideastring = tostring(newidea)
msgservice:PublishAsync("AddNewElementForVoting", newideastring)

When I run it, it sends "Air", which if you looked was the thing that I was trying to clone, but I changed it. I was hoping the changes would cross over too but that didn't happen. Even if they did, how would I put it into the game? I realize that I also need a way of undoing it so I can make it back into a frame with the correct parent and children. I'm pretty stumped about this. Do I have to put it into a weird table? Is it just impossible? I hope you can help. Thanks.

1 answer

Log in to vote
0
Answered by
Jac_00b 157
3 years ago

I have found a solution: You can encode it and then decode it with HTTPService. I hope this helps anyone who has the same issue.

Ad

Answer this question