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

is it possible to print boolean?

Asked by 5 years ago
01player = {"WindowMall"}
02local players = game:GetService("Players")
03local replicatedstorage = game:GetService("ReplicatedStorage")
04local hatsfolder = replicatedstorage:WaitForChild("Hats")
05local Dominus = hatsfolder:WaitForChild("Dominus")
06 
07for i,plr in pairs(players:GetPlayers()) do
08    local check = false
09    if players.Name == player[1] then
10        return true
11    else
12        return false
13    end
14    print(check)
15end****

also i had a gui when i click the text it will fire

1 answer

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

You can, actually.

You can print a boolean using a built-in function called tostring(value). In a nutshell, tostring() turns any value into a string. For example:

1local var = true
2print(tostring(var)) --true

In your case, on line 14, you should change print(check) to print(tostring(check))

Edited Code:

01player = {"WindowMall"}
02local players = game:GetService("Players")
03local replicatedstorage = game:GetService("ReplicatedStorage")
04local hatsfolder = replicatedstorage:WaitForChild("Hats")
05local Dominus = hatsfolder:WaitForChild("Dominus")
06 
07for i,plr in pairs(players:GetPlayers()) do
08    local check = false
09    if players.Name == player[1] then
10        return true
11    else
12        return false
13    end
14    print(tostring(check)) --edited
15end****
Ad

Answer this question