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

How to replicate the input of a textbox to the server?

Asked by 3 years ago
Edited 3 years ago

Hello so i am trying to make a system where people can buy things off the roblox catalog. I want the asset name of the product to load in, but it just does not. the script works when the string value 'asset' is definite. But i want to have a player be able to paste an itemid into a textbox then hit search. EDIT: I have now realized that this has to do with replication and i have changed the question

Script Inside of the text label

local MPS = game:GetService("MarketplaceService")
local ID = script.Parent.Parent.Asset.Value
local SB = script.Parent.Parent.Parent.SB
local function getAssetName(assetID)
    assetID = tonumber(assetID)
    if not assetID then return nil end
    local assetName = MPS:GetProductInfo(assetID, 0)

    return assetName.Name
end

SB.MouseButton1Click:Connect(function()
wait(1.5)
script.Parent.Text = getAssetName(ID) or "Error"
end)

if you can see i put a delay on the get asset name so there would be time for the value to update. But that didnt really work. And what happens is it goes to Error which is the or.

script inside of the Asset Value to update it to the textbox's input

local S = script.Parent.Parent.Parent.SB
S.MouseButton1Click:Connect(function()
script.Parent.Value = script.Parent.Parent.Parent.Input.Text
end)

I really am not sure how to fix this. I feel that it is the script inside of asset value since it just feels crappy to me.

0
NOTE: i have tried making the ID be the textbox's text but that did not want to work either. Ultim8creeper 15 — 3y
0
ALSO: this is what i get when i print the ID:   11:19:42.003   -  Client  -  LocalScript:14 Ultim8creeper 15 — 3y

Answer this question