Why does my localscript keep returning error: attempt to index string with 'Text'?
I am working on an order system for a restaurant, and want to be able to record the username of the person ordering the food. So i created this localscript
1 | script.Parent.Activated:Connect( function () |
3 | local clone = game.StarterGui.Clonerdon.Order:Clone() clone.Parent = game.Workspace [ "Order taker" ] .Screen.SurfaceGui.ScrollingFrame |
5 | local username = script.Parent.Parent.TextBox.Text |
6 | clone.Name.Text = username |
The localscript is in a textbutton in a frame in a screenGui.
The clone's children are: Name (textlabel)
Order (textlabel)
Done (textbutton)
script.Parent is a textbutton, and script.Parent.Parent.TextBox is a textbox.
Everytime i click one this button after entering a random word or username, it returns this error:
TextButton.LocalScript:6: attempt to index string with 'Text'
Script 'Players.Sergeant_Ranger.PlayerGui.Register.Frame.Ordersubmission.TextButton.LocalScript', Line 6
I have absolutely no idea why this is happening, but I imagine it might be an error stemming from how Roblox gets text from textlabels and textboxes.
Any help would be appreciated.