generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Inventory GUI not working properly

Previous Thread :: Next Thread 
Widest is not online. 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 is not online. 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 is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
05 Aug 2016 11:53 PM
oops wrong account


-iJava
Report Abuse
Weirdraidercs35 is not online. Weirdraidercs35
Joined: 14 May 2015
Total Posts: 2275
06 Aug 2016 12:09 AM
do you have an account named heights or lengths >


im a mlg
Report Abuse
Widths is not online. 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
XandertjeKnal is not online. XandertjeKnal
Joined: 25 Feb 2016
Total Posts: 543
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
XandertjeKnal is not online. XandertjeKnal
Joined: 25 Feb 2016
Total Posts: 543
06 Aug 2016 02:15 AM
I currently did this job for Widest, Widths.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image