|
| 08 Jul 2017 03:25 AM |
so i have a StringValue and a table how can i check if the Stringvalue's value is in the table?
contents;
table={a,b,c}
StringValue located in ServerStorage
StringValue's value is "b" as of now. |
|
|
| Report Abuse |
|
|
BaiYuni
|
  |
| Joined: 09 Oct 2009 |
| Total Posts: 2861 |
|
|
| 08 Jul 2017 03:28 AM |
for _, v in pairs(table) do if game:GetService("ServerStorage"):WaitForChild("Value").Value == v then return true end end
|
|
|
| Report Abuse |
|
|
BaiYuni
|
  |
| Joined: 09 Oct 2009 |
| Total Posts: 2861 |
|
|
| 08 Jul 2017 03:28 AM |
| But I don't think you created a table of String values. |
|
|
| Report Abuse |
|
|
|
| 08 Jul 2017 03:46 AM |
script stops here
if game:GetService("ServerStorage"):WaitForChild("Value").Value == v then
and there's a warning[not error] on output: Infinite yield possible on 'ServerStorage:WaitForChild("Value")' |
|
|
| Report Abuse |
|
|
| |
|
JoshRBX
|
  |
| Joined: 19 May 2012 |
| Total Posts: 8778 |
|
|
| 08 Jul 2017 04:08 AM |
local function checkStr(tbl) for _, v in pairs(tbl) do if type(v) == "string" then return true end end return false end |
|
|
| Report Abuse |
|
|
JoshRBX
|
  |
| Joined: 19 May 2012 |
| Total Posts: 8778 |
|
|
| 08 Jul 2017 04:09 AM |
misread, ignore my last post you need to make sure that there is an object by the name of 'Value' located in the ServerStorage then. |
|
|
| Report Abuse |
|
|
Isosta
|
  |
| Joined: 10 May 2015 |
| Total Posts: 14729 |
|
|
| 08 Jul 2017 04:32 AM |
you don't need getservice for default enabled services
|
|
|
| Report Abuse |
|
|
|
| 08 Jul 2017 04:32 AM |
uh no "StringValue" is an actual ObjectValue located in game.ServerStorage lol
bump |
|
|
| Report Abuse |
|
|
Isosta
|
  |
| Joined: 10 May 2015 |
| Total Posts: 14729 |
|
|
| 08 Jul 2017 04:42 AM |
you're doing something wrong.
what's the string value named
|
|
|
| Report Abuse |
|
|
Isosta
|
  |
| Joined: 10 May 2015 |
| Total Posts: 14729 |
|
|
| 08 Jul 2017 04:42 AM |
wait, is this a local or server script
|
|
|
| Report Abuse |
|
|
|
| 08 Jul 2017 04:44 AM |
| solved. Thanks for the help. |
|
|
| Report Abuse |
|
|