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
player = {"WindowMall"}
local players = game:GetService("Players")
local replicatedstorage = game:GetService("ReplicatedStorage")
local hatsfolder = replicatedstorage:WaitForChild("Hats")
local Dominus = hatsfolder:WaitForChild("Dominus")

for i,plr in pairs(players:GetPlayers()) do
    local check = false
    if players.Name == player[1] then
        return true
    else
        return false
    end
    print(check)
end****

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:

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

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

Edited Code:

player = {"WindowMall"}
local players = game:GetService("Players")
local replicatedstorage = game:GetService("ReplicatedStorage")
local hatsfolder = replicatedstorage:WaitForChild("Hats")
local Dominus = hatsfolder:WaitForChild("Dominus")

for i,plr in pairs(players:GetPlayers()) do
    local check = false
    if players.Name == player[1] then
        return true
    else
        return false
    end
    print(tostring(check)) --edited
end****
Ad

Answer this question