generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: why doesn't this work...

Previous Thread :: Next Thread 
zaniac10 is online. 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 is online. 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 is not online. 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 is online. zaniac10
Joined: 18 Aug 2009
Total Posts: 10000
10 Nov 2015 01:24 PM
..why not?
Report Abuse
powertool is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image