im trying to make a textbox that when a player type in something then click a button, it will take the text from the textbox and put it into a stringvalue but i get this error : bad argument #3 to 'Value' (string expected, got nil)
local player = game.Players.LocalPlayer local name = game.Lighting.Players:FindFirstChild(player.Name).CivilName function Done() player.Backpack.Camera:Destroy() local named = script.Parent.Name.Text name.Value = named
On line 5, you attempt to index script.Parent.Name
. I assume you're trying to get a child of script.Parent
with the name "Name", but Lua assumes you mean the Name
property of script.Parent
. You then attempt to index Name
, which would just be a string in this case. You can remedy this using FindFirstChild
:
local player = game.Players.LocalPlayer local name = game.Lighting.Players:FindFirstChild(player.Name).CivilName function Done() player.Backpack.Camera:Destroy() local named = script.Parent:FindFirstChild('Name').Text name.Value = named end;
Hope this helped.