How do I use module scripts

Thank you very much, how would I actually get the list variable from another server script?

1 Like

You can add a function for that too.

function module:GetThumbnailList()
return self.thumbnails
end
2 Likes

Thanks but what line of code would I run to call that actual function?

1 Like

Look at this

You can just run IconModule:GetThumbnailList() similar to how I ran AddIcon.

2 Likes

Yes, lol. I edited my previous post.
@ExercitusMortem 's method is the one I would prefer to use though as all the functions to manipulate the data are in the same place, and makes it a lot easier to manage later on.

2 Likes

Hi, sorry I’m having an issue with getting to work, for some reason its not displaying the icon, i’m getting no errors its just not working.

playEvent.OnServerEvent:Connect(function()
	
	local playerThumbnails = IconModule:GetThumbnailList()
	
    -- This prints the players Ids (idk if that what its supposed to do)
	print(playerThumbnails)
	
	if #gamePlayers == 6 then

		local content1 = playerThumbnails[tostring(gamePlayers[1].UserId)]
		
		for i = 6, 1, -1 do
            -- This should display the players icon but its not doing anything
			gamePlayers[i].PlayerGui.Scoreboard.Frame.Team1.Player1.Image = content1
1 Like

Use the module. Just do module:GetIcon(player).

Also

You’d need to set the ImageId of the image object. Not set the image to that.

2 Likes

Thank you, how would I assign the imageId? In the properties of the image label i can only see “image”. Thanks

1 Like

Oh, my bad, it is image. Can you do

print(module:GetThumbnailList())

and send me the result

1 Like

Would I be silly to say module scripts seem to be being over used? Would it serve your purpose just to get players thumbnails as they enter and just save it in the player. That way you don’t need to maintain a list table as people leave. The player and their thumbnail would still be available by all your server scripts.

1 Like

image

Thats my user id btw

Honestly I have no idea, I’m quite bad at programming, maybe someone better than me will know whether I can do it this way. Thanks for the help though

… you need to change thumbnailID to the ID that you want the thumbnail to be lol

1 Like

So would I use the getasync thing and store the value in that string?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.