zaniac10
|
  |
| Joined: 18 Aug 2009 |
| Total Posts: 10000 |
|
|
| 10 Nov 2015 01:18 PM |
the gui only appears when i hover over a part with the name "Bottlecap" (because it's the last one in the table
so why doesn't it do it for the other things in the table?
local plr = game.Players.LocalPlayer repeat wait() until plr.Character local char = plr.Character local mouse = plr:GetMouse() local items = { "cup", "metal scraps", "bottlecap", }
while wait() do for _,itams in pairs(items) do if mouse.Target ~= nil and mouse.Target.Name:lower() == itams then script.Parent.Text = "[Press 'E' to pick up " ..itams.. "]" script.Parent.Visible = true else script.Parent.Visible = false end end end
|
|
|
| Report Abuse |
|
|
zaniac10
|
  |
| Joined: 18 Aug 2009 |
| Total Posts: 10000 |
|
|
| 10 Nov 2015 01:21 PM |
| also i tried using mouse.Changed instead of while wait() do, but that made it so none of the items in the table make the gui pop up at all |
|
|
| Report Abuse |
|
|
powertool
|
  |
| Joined: 01 Feb 2008 |
| Total Posts: 3771 |
|
|
| 10 Nov 2015 01:22 PM |
| Don't bump a thread that's five minutes old. |
|
|
| Report Abuse |
|
|
zaniac10
|
  |
| Joined: 18 Aug 2009 |
| Total Posts: 10000 |
|
| |
|
powertool
|
  |
| Joined: 01 Feb 2008 |
| Total Posts: 3771 |
|
|
| 10 Nov 2015 01:24 PM |
local items = { [1]="cup", [2]="scrap", [3]="bottlecap" }
mouse.Changed:connect(function() for index,name in pairs(items) do if mouse.Targetl and mouse.Target.Name:lower == items[index] then do(stuff) else return end end end)
Try that, make sure you define mouse somehow. |
|
|
| Report Abuse |
|
|
powertool
|
  |
| Joined: 01 Feb 2008 |
| Total Posts: 3771 |
|
|
| 10 Nov 2015 01:25 PM |
| And the reason that we do not bump five-minute-old threads is one of respect. Repeatedly bumping a thread doesn't get you an answer quicker, it does get everyone's wrath upon you. |
|
|
| Report Abuse |
|
|