local train = script.Parent.V.Value local textFunc = train:WaitForChild("TextFunction")
script.Parent.Frame.TextBox.Changed:connect(function(prop) if prop == "Text" then textFunc:InvokeServer(script.Parent.Frame.TextBox.Text) --Line 7 of local script end end)
~~~~~SCRIPT~~~~~~~~~
local ReplicatedStorage = game:GetService("ReplicatedStorage") local textFunc = Instance.new("RemoteFunction") textFunc.Parent = script.Parent textFunc.Name = "TextFunction"
local function onTextRequested(text) for i, v in pairs(script.Parent:GetChildren()) do if v.Name == "RearCar" or v.Name == "CenterCar" then v.TxtVal.Value = text -- this is line 9 in the script end end end
textFunc.OnServerInvoke = onTextRequested
When I change the text of the textbox, causing InvokeServer, the output returns:
Workspace.Train.Text Event Script:9: bad argument #3 to 'Value' (string expected, got Object)
It says the source of the error Is line 7 of the local script.
Why does it say it got an Object if I provided the argument (script.Parent.Frame.TextBox.Text) which is a string??

3 comments
Try printing out text to see what comes up.
Wait I see the issue haha
the first argument is player, the second is text