String.find unable to assign property text?

Why wont my script work, I keep getting error string.find unable to assign property text. string expected got nil. Any help would be appreciated. C:

Code;
local HttpService = game:GetService(“HttpService”)

local url = “REDACTED”

while true do
for _, card in pairs(script.Parent.SurfaceGui.Frame.ScrollingFrame:GetChildren()) do
card:Destroy()
end
wait(0.1)
local req = HttpService:GetAsync(url)
local jsontable = HttpService:JSONDecode(req)
for _, card in pairs(jsontable) do
if card.name == “—” then

    elseif card.name == "‏‏‎ ‎" then
    elseif card.name == "---‎" then
    else
        
        local clone = script.Template:Clone()
        clone.Name = "Cloned"
        clone.Parent = script.Parent.SurfaceGui.Frame.ScrollingFrame
        if string.find(card.name, "Interview") then
            clone.Template.Text = "Interviews"
        elseif string.find(card.name, "Training") then
            clone.Template.Text = "Trainings"
        else
            clone.Template.Text = string.split(card.name, " ")[3]
        end
        clone.Host.Text = string.split(card.name, " ")[1]
        
        local clone2 = script.UIListLayout:Clone()
        clone2.Parent = script.Parent.SurfaceGui.Frame.ScrollingFrame
        clone.TimeVal.Value = card.due
    end

end
wait(60)

end
[/quote]

Why wont my script work, I keep getting error string.find unable to assign property text. string expected got nil. Any help would be appreciated. C:

Code;

local HttpService = game:GetService(“HttpService”)

local url = “REDACTED”

while true do
for _, card in pairs(script.Parent.SurfaceGui.Frame.ScrollingFrame:GetChildren()) do
card:Destroy()
end
wait(0.1)
local req = HttpService:GetAsync(url)
local jsontable = HttpService:JSONDecode(req)
for _, card in pairs(jsontable) do
if card.name == “—” then

    elseif card.name == "‏‏‎ ‎" then
    elseif card.name == "---‎" then
    else
        
        local clone = script.Template:Clone()
        clone.Name = "Cloned"
        clone.Parent = script.Parent.SurfaceGui.Frame.ScrollingFrame
        if string.find(card.name, "Interview") then
            clone.Template.Text = "Interviews"
        elseif string.find(card.name, "Training") then
            clone.Template.Text = "Trainings"
        else
            clone.Template.Text = string.split(card.name, " ")[3]
        end
        clone.Host.Text = string.split(card.name, " ")[1]
        
        local clone2 = script.UIListLayout:Clone()
        clone2.Parent = script.Parent.SurfaceGui.Frame.ScrollingFrame
        clone.TimeVal.Value = card.due
    end

end
wait(60)

end

1 Like

try capitalizing .Name, you need to do this in multiple spots

I’ll try that shortly. Thanks.

That didn’t work, getting this error now;

Workspace.Sessions.Script:22: invalid argument #1 to ‘find’ (string expected, got nil)

Try string.lower(card.name), maybe card.name is not a string

Well, the thing is card.name is nil which is why I suggest .Name since that is what the actual property is called. The name of an object will be a string unless nil, the string.lower MIGHT fix the error but not the code because it would always run the else

.name is also a valid property.

Didn’t work either. Getting;
Workspace.Sessions.Script:22: invalid argument #1 to ‘lower’ (string expected, got nil)

Write print(card) because the errors are indicating that card doesn’t contain anything related to name

Nothing in the log. I don’t see anything on there. Still the same error

@HugeCoolboy2007

I got nothing within the log however I am still continuing to get the same error.

Can we see what’s inside jsontable

I actually fixed it. I need to close the post

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.