Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

script prints "nil" even though there is something there?

Asked by
zomspi 541 Moderation Voter
4 years ago

I have 2 text boxes and my script prints one of them but not the other, the "potatoes" is printing fine, but the "name" isn't, could anyone tell me why this would be?

script.Parent.MouseButton1Click:Connect(function()
    local name = script.Parent.Name.Text
    local potatoes = script.Parent.Potatoes.Text
    if name ~= "" and potatoes ~= "" then
        print(tonumber(potatoes))
        print(tostring(name))
        game.ReplicatedStorage.PotatoesCommand:FireServer(name, potatoes)
    end

end)

0
It means that potatoes is not a number nc2r 117 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

Try changing script.Parent.Name 's name to something else since it might think you're trying to get the parent's actual name.

0
omg thank you so much! zomspi 541 — 4y
Ad

Answer this question