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

how can I set a string value to nil?

Asked by 5 years ago
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.

0
What is the error? BlackOrange3343 2676 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

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 = ""
Ad

Answer this question