Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how can I set a string value to nil?

local stringval = script.Parent.StringValueObject

stringval.Value = game.Workspace.ExampleObject2.Name

wait(3)

stringval.Value = nil

I know by setting an intvalue to nil you can reset the number to 0, but what about stringvalues? when I try to set it to nil it throws an error.

1 comment

0

What is the error?

1 answer

✓ Accepted answer

You cannot set it to nil, as nil in Lua (more so than other languages) is used to represent nothing rather than an unset value, but what you can do if you want to pretend it's nil is

StringValueObject.Value = "nil"

Or simply

StringValueObject.Value = ""

This discussion is preserved as it was. New answers, comments, and votes are closed.