So in my game, i have a custom map making system, where users are able to save maps and load them whenever they want. However, im going through a road-block trying to implement a map searching system, where you are able to type the name of something, and it will list all the existing keys and find if the map names match the current string that was typed.
The problem is that, it takes too long to even find a singular map. And there doesn’t seem to be anyway i can improve this delay within it. And it’s not like i know any other solutions, especially when in the DevForum, not many people have talked about this issue, or even anything similar regarding it.
For further explanation, the “temp” is the template for the map button, where it includes the name of the map, and the creator of it, aswell as a button next to it, where you are able to load it.
local nextpagecursor = 0
local pages = slots:ListKeysAsync(nil, 20, nil, true)
repeat
local keys = pages:GetCurrentPage()
for i,v in pairs(keys) do
local find = slots:GetAsync(v.KeyName)
for s = 1, #find do
if find[s] ~= nil and string.lower(find[s].Name):match(text:lower()) then
print("found")
local temp = game.ServerScriptService.Server.customtemp:Clone()
local filter = game:GetService("TextService"):FilterStringAsync(find[s].Name, plr.UserId)
local filterstring = filter:GetNonChatStringForBroadcastAsync()
temp.name.Text = filterstring
local new = v.KeyName:split("#")
local plrname = "Banned User"
pcall(function()
if game.Players:GetNameFromUserIdAsync(new[1]) then
plrname = game.Players:GetNameFromUserIdAsync(new[1])
end
end)
temp.creator.Text = "By "..plrname
temp.ID.Value = s
temp.Name = "Slot "..s
temp.Parent = script.Parent
temp.Load.MouseButton1Click:Connect(function()
if loading == false and plr.Rank.Value > 1 then
loading = true
loadmap.loadmap(find[s].ID, loading, plr, script.Parent.Parent.Parent)
loading = false
end
end)
end
end
end
pages:AdvanceToNextPageAsync()
until pages.IsFinished