Widest
|
  |
| Joined: 17 Oct 2014 |
| Total Posts: 971 |
|
|
| 05 Aug 2016 11:33 PM |
I'm trying to make an inventory GUI that loads pages of 6 items at a time, with next & previous page buttons to load the next 6 items. However, for some reason, it's really glitchy and only the first up to 6 items load properly. Clicking the Next button should disallow you to view the next page and should instead reload the current page if that page would be empty, but that isn't working properly
I'll pay 250 ROBUX for someone to fix this so that it is fully functional
Here's my code:
local lastVisible = script.Parent.Visible local plr = script.Parent.Parent.Parent.Parent local currentFrame = 1
function loadPage(frame) --this function is where I assume all of the issues are occuring in local pokemon = getPokemons() if frame >= 1 and (#pokemon/6 >= frame or (#pokemon<6 and frame == 1))then local loadPokemon = {} --should be filled with up to 6 pokemon for i=((frame-1)*6)+1,frame*6 do local poke = pokemon[i] if poke ~= nil then table.insert(loadPokemon, poke) print(poke.Name) else print(i) end end elseif #pokemon == 0 then --nothin yet else print("Loading "..frame-1) loadPage(frame-1) end end
function getPokemons() local serverData = game.ServerStorage:FindFirstChild("ServerData") local plrServerData = serverData:FindFirstChild(plr.Name) local pokemons = {} if plrServerData ~= nil then for i,v in pairs(plrServerData:GetChildren()) do if v:IsA("BoolValue") then local pokemon = _G["Pokemon"][v.Name] if pokemon ~= nil then table.insert(pokemons, pokemon) end end end end return pokemons end
script.Parent.Changed:connect(function() if script.Parent.Visible == true and lastVisible ~= script.Parent.Visible then lastVisible = script.Parent.Visible loadPage(1) end end)
script.Parent.Next.TextButton.MouseButton1Click:connect(function() loadPage(currentFrame+1) end)
script.Parent.Previous.TextButton.MouseButton1Click:connect(function() if currentFrame > 1 then loadPage(currentFrame-1) end end)
-iJava |
|
|
| Report Abuse |
|
|
Widest
|
  |
| Joined: 17 Oct 2014 |
| Total Posts: 971 |
|
|
| 05 Aug 2016 11:52 PM |
To further explain the problem: If you have under 7 items, it works fine. If you own 7 to 11 items, it will only load the first page still. If you have 12 or more items, the Next button repeatedly loads the second page, regardless of how many items you have
-iJava |
|
|
| Report Abuse |
|
|
Widths
|
  |
| Joined: 12 Aug 2014 |
| Total Posts: 41286 |
|
| |
|
|
| 06 Aug 2016 12:09 AM |
do you have an account named heights or lengths >
im a mlg |
|
|
| Report Abuse |
|
|
Widths
|
  |
| Joined: 12 Aug 2014 |
| Total Posts: 41286 |
|
|
| 06 Aug 2016 12:11 AM |
No, but I'm friends with the user named "lengths" but I think he quit/went inactive
-iJava |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2016 12:24 AM |
Can you maybe send me the gui you currently have + a script with the Global function you use?
I might be able to the script I made, just by converting some variables. |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2016 02:15 AM |
| I currently did this job for Widest, Widths. |
|
|
| Report Abuse |
|
|