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

4 comments
Everything works properly. But Only shows one part instead of the rest in workspace, instead of telling me that its only one object, how about you tell him how to fix it?
Also that module script is not complete, the real one with all the items have atleast 300 lines of code, and has a proper closing.
I'm saying if I have two items in workspace named flashlight it would only display one of them
Then next time be more specific in your question.