LocalWE
(WilliApple)
October 3, 2020, 1:51am
#1
Hello! I am WEcompany. I am trying to create a build mode for my game. What I need help with is finding a variable. For example,
local variable = script.Parent.Parent.Value --Lets just say that this is Yeet for now
print(workspace[[Variable]])
and the expected output should be
Yeet
I looked all over the DevHub and cannot find it. Can you show me how I would be able to print Yeet for example? Thank you, WE
Noskur2
(Noskur2)
October 3, 2020, 1:52am
#2
don’t know what your code above is but you could use a table and check the index value
do you mean,
print(workspace[Variable])
edit: You can’t have a dot before a “[”(idk whats this called lol.
You can make use of GetFullName()
, so:
print(variable:GetFullName()) -- game.workspace.path
1 Like
LocalWE
(WilliApple)
October 3, 2020, 1:52am
#5
Yes. That is what I mean. I just have never learned how to do that.
1 Like
Map1eMoose
(MapleMoose)
October 3, 2020, 1:54am
#6
Do you mean
local variable = script.Parent.Variable--Variable itself
local Variable = script.Parent.Variable.Name--The Variable Name
local Variable = script.Parent.Value--The variables value
LocalWE
(WilliApple)
October 3, 2020, 1:57am
#7
That is printing as the game name.
Is that value a StringValue or an Object Value or a child of script.Parent.Parent?
If it is a StringValue then it should be:
print(workspace[variable])
If it is an ObjectValue then it should be:
print(workspace[variable])
edit: Nevermind, ignore this message. you can do it the same ways lol.
cakefarmer
(theoppositions)
October 3, 2020, 2:06am
#10
If the Value is Yeet, Whatever Your Part is Or Model or another Instance Shoud be Named Yeet.
local Varible = script.Parent.Parent.Value
wait(3)
print(workspace[Varible])
LocalWE
(WilliApple)
October 3, 2020, 2:09am
#11
Well I got this error. I think its because it is a localscript.
I don’t really want people “stealing” the stuff I am making. I created this as an example.
Here is what I am trying to do:
local oindex = script.Parent.Parent.Parent.Parent.Oindex.Value
script.Parent.InputChanged:Connect(function()
print(game[oindex])
end)
what would your oindex be?
I assume your oindex value would be empty at first, so you may need to set the oindex.
what are you trying to do, Are you making some type of a search thingy?
cakefarmer
(theoppositions)
October 3, 2020, 2:14am
#13
Is it In workspace or Another Service? You said game[oindex], unless its another service that wont work
LocalWE
(WilliApple)
October 3, 2020, 2:16am
#14
oindex is something inside the client. Im creating a build system.
LocalWE
(WilliApple)
October 3, 2020, 2:16am
#15
Im trying to create a properties window inside of studio. Im just printing for tests. It is an object value and yes it is empty.
cakefarmer
(theoppositions)
October 3, 2020, 2:19am
#16
Inside the Player? if Its inside the Player it would be Game
cakefarmer
(theoppositions)
October 3, 2020, 2:20am
#17
I Would Suggest Using Player or Accessing it Through the Player an not Game
Player:FindFirstChild(oindex)
LocalWE
(WilliApple)
October 3, 2020, 2:21am
#18
Well I am trying to modify stuff inside of lighting with this script, for example, ambient.
cakefarmer
(theoppositions)
October 3, 2020, 2:21am
#19
if you Trying to Get Something Inside of Lighting you would do game.Lighting[oindex]
LocalWE
(WilliApple)
October 3, 2020, 2:24am
#20
This is printing Instance
What I tried:
local oindex = script.Parent.Parent.Parent.Parent.Oindex.Value
script.Parent.InputChanged:Connect(function()
print(game:FindFirstChild(oindex).Name)
end)
I even tried it without name, and oindex.Value
is currently equal to Lighting.