Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Mouse.Target is only showing one part?

Asked by 8 years ago

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

1 answer

Log in to vote
1
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
8 years ago
Edited 8 years ago

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

0
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? SkilledFlame 3 — 8y
0
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. SkilledFlame 3 — 8y
0
I'm saying if I have two items in workspace named flashlight it would only display one of them SkilledFlame 3 — 8y
0
Then next time be more specific in your question. RubenKan 3615 — 8y
Ad

Answer this question