Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I reliably get shirt and pants asset ids from regular shirt and pants ids?

I know it has been done before, but I am curious how. I currently have a setup which doesn't work:

script.Parent.RemoteFunction.OnServerInvoke = function(plr, val)
print("start")
val = string.split(val, ",")
script.Parent.val1.Value = val[1]
script.Parent.val2.Value = val[2]

repeat
local success, response = pcall(function()
workspace.test.shirt.ShirtTemplate = "http://www.roblox.com/asset/?id="..script.Parent.val1.Value
  end)
if not success then
script.Parent.val1.Value = script.Parent.val1.Value - 1
end
until success

repeat
local success, response = pcall(function()
workspace.test.pants.PantsTemplate = "http://www.roblox.com/asset/?id="..script.Parent.val2.Value
  end)
if not success then
script.Parent.val2.Value = script.Parent.val2.Value - 1
end
until success

script.Parent.Dummy.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id="..script.Parent.val1.Value
script.Parent.Dummy.Pants.PantsTemplate = "http://www.roblox.com/asset/?id="..script.Parent.val2.Value
end

1 answer

i understand what u want to do but im not sure if its gonna work but i think this is what u tried to do

function repeatUntilWork(id)
	local success, response = pcall(function()
     	--do id stuff
   
 	 end)
  	if not succes then
  	  repeatUntilWork(id-1)
 	 end
end

yours didnt work due to scope issues, you defined success inside the repeat loop but then u try to acces it outside the repeat scope

This discussion is preserved as it was. New answers, comments, and votes are closed.