I am currently developing a FNaF AR inspired Roblox game, I’m having major issues with GUI icons.
Basically, there’s a menu in the game where you can assemble animatronics using the suits and CPUs unlocked from fighting said animatronics - but it seems to be causing issues with the icons.
The only issue I’m having with this is that all the icons are being swapped out for one specific icon (being Freddy’s, the way I want it to be is that depending on the save data value it’ll change that specific slot’s icon to that data value, but it does this strange behaviour where it only applies one single character’s icon to all icon, instead of just one)
function workshopIconsRefresh()
for i, image in pairs(GUI.Workshop.ScrollingFrame:GetChildren()) do
for i, data in pairs(player["Save Data"].Workshop:GetDescendants()) do
if image:IsA("ImageButton") then
if data:IsA"StringValue" and data.Name == "Suit" then
image.Image = AnimatronicInfo[data.Value]["Items"]["SuitImage"]
end
end
end
end
end
How so? The images are set through the string values of the save data, which the strings are names of the characters, it then pulls the image IDs out of a module.
I’m not sure if this was the wrong way to go or not.
Assuming the imagebutton has the same name as the value from the data from this line
I would assume like this:
function workshopIconsRefresh()
for i, image in pairs(GUI.Workshop.ScrollingFrame:GetChildren()) do
for i, data in pairs(player["Save Data"].Workshop:GetDescendants()) do
if image:IsA("ImageButton") then
if data:IsA("StringValue") and data.Name == "Suit" and data.Value == image.Name then
image.Image = AnimatronicInfo[data.Value]["Items"]["SuitImage"]
end
end
end
end
end
If that’s not the case, could I see the explorer of the image buttons and the data values?
The way I have it setup for beta testing purposes is that Odd numbers pull Freddy and even pull Chica to make sure it works - but it seems all of them pull Chica only.
Is there some sort of value inside of the ImageButtons that allow you to determine which animatronic it is meant to be? Actually, since I have just read the text below the images, this is what it should be:
function workshopIconsRefresh()
for i, image in pairs(GUI.Workshop.ScrollingFrame:GetChildren()) do
if image:IsA("ImageButton") then
image.Image = AnimatronicInfo[player["Save Data"].Workshop:FindFirstChild(image.Name).Suit.Value]["Items"]["SuitImage"]
end
end
end
Nope, the way I set it up is that it just pulls it from the save data, should I change this to make it change values inside the imagebuttons to the save data and THEN change the image to those values?