How would I find a variable in a script?

Ok So What Is the Values Parent?

The Player?

A ScreenGUI named Explorer; and that is inside of the Players GUI

Ok so If the Value is Inside a ScreenGui do

local oindex = game.Players.LocalPlayer.PlayerGui.Explorer:FindFirstChild("0index").Value

script.Parent.InputChanged:Connect(function()
      print(game:FindFirstChild(oindex))
end)

Nothing is coming up now. Wouldn’t script.Parent.Parent.Parent.Parent.Oindex.Value work just fine since that is the same thing?

local player = game.Players.LocalPlayer

script.Parent.InputChanged:Connect(function()
	print(player.PlayerGui:FindFirstChild("0index").Value)
end)

This Should work

Well, yes it does work, but once I get this done and solved, I would change the script to be something like

local oindex = script.Parent.Parent.Parent.Parent.Oindex.Value

script.Parent.InputChanged:Connect(function()
	game:FindFirstChild(oindex).ShadowSoftness = script.Parent.Text --FindFirstChild is a temporary replacement for locating Lighting. 

end)

If it’s an ObjectValue, you already have the object. It’s just variable.

2 Likes

Here is a video of the problem:

Expected output should be:
image

Hello, can you try this.


script.Parent.InputChanged:Connect(function()
local oindex = script.Parent.Parent.Parent.Parent.Oindex.Value
game:FindFirstChild(oindex).ShadowSoftness = script.Parent.Text

end)```

Unfortunately, it doesn’t work. For now I want to test print. Is that ok? I know how to change the values but I just cant find out how to define oindex.

Try

print(variable) 
-- It will print whatever you define variable as or its value 

no. I am trying to print Lighting.

local variable = script.Parent.Parent.Value --Value == lighting
print(game:WaitForChild(variable))
local variable = game.Lighting.Name
print(variable)