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

Attempt to concatenate field a boolean value?

Asked by 8 years ago

I was wondering if anyone can tell me what I'm doing wrong as why A is working and B isn't? Sorry it's kinda hard for me to explain it. ._.

Script that works(A):

print(game.Workspace.FilteringEnabled)

Script that doesn't work(B):

print("FilteringEnabled: "..game.Workspace.FilteringEnabled)

Any help appreciated.

0
Could you describe what the "FilteringEnabled" object of the workspace is. Try using "game.Workspace.FilteringEnabled.Name". LateralLace 297 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago
local filtBool = game.Workspace.FilteringEnabled  -- Get the value of 'game.Workspace.FilteringEnabled'

if filtBool then  -- 'if filtBool == true then'
    filtBool = "true"
elseif not filtBool then  -- 'if filtBool == false then'
    filtBool = "false"
end

print("FolteringEnabled: " .. filtBool")

Bools can't be concatenated. Only numbers and strings. Sorry fam.

Ad

Answer this question