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
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