Hello,
I was trying to script something where when you put an item ID from roblox into a text box, it sends that ID to a value inside a folder in the player, and from there, there is a script inside of the screengui of playergui that allows the text boxes inside of the screengui to get information from that ID. The problem is that the script only runs one time (when the player joins the game) and does not update when the player puts a new ID. By default, the value is set to nothing. Tried wrapping everything in a while wait() do loop and still nothing. Here is some of the script:
local player = game.Players.LocalPlayer
local gui = player.PlayerGui.InfoProvider.Frame
local Asset = wait(.05) do game:GetService("MarketplaceService"):GetProductInfo(player.leaderstats.ItemID.Value)
I just want the value of player.leaderstats.ItemID.Value to update when the player changes it, or update every .05 seconds.
Thanks!
I need the game:GetService("MarketplaceService"):GetProductInfo(player.leaderstats.ItemID.Value) to be a local value though, or the script won’t work.
But I need the variable to change when the user inputs a new id. game:GetService(“MarketplaceService”):GetProductInfo(player.leaderstats.ItemID.Value) <<< I need that part to update.
Oh wait hold up
I forgot something
EDIT: Nevermind. player.leaderstats.ItemID:GetPropertyChangedSignal() is not an actual “function” in roblox. It doesn’t put an end on the end of the player.leaderstats.ItemID:GetPropertyChangedSignal() when I hit enter.
Of course! What you could do to optimize your code is wrap the following code in a function and updating it when the value changes. Your code is only executing at the start of the game and not when anything is changing.