I'm trying to make a survival game, right now I am working on the gui where it shows the text of what the item is and gives a message about the item,
But It only works on one item, and not the others. please help?
local checkpart = function() for items,v in pairs(itemmodule) do if mouse.Target == itemmodule[items].directory then changetext(ptb,itemmodule[items].name.. " [E]") changetext(tmessage,itemmodule[items].message) ptb.Visible = true; tmessage.Visible = true; elseif mouse.Target == nil or mouse.Target == game.Workspace.Baseplate then ptb.Visible = false; tmessage.Visible = false; end end end
this is the module for the items
folderitem = game.Workspace:WaitForChild("folderitem"); local data = { flashlight = { directory = folderitem:WaitForChild("flashlight"); name = "FLASHLIGHT"; message = "CAN BE USED IN DARK PLACES"; }, return data
The reason
The reason you only see one item, is because there is only one item in your table. Come on, you should've seen that.
-
More important
You don't close your data table in the module script correctly. You forgot a } and there's a comma. Im suprised you didn't see that.
Check your Output for errors next time ;p