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

Anybody know how to convert a bool value into a string?

Asked by
Foridex 46
6 years ago

Anybody know how to convert a bool value into a string?

Like if a bool value was true it would play a string, but if it wasn't it would do something else?

0
tostring(bool) MooMooThalahlah 421 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago
Edited 5 years ago
local happy = Instance.new("BoolValue", game.Workspace) -- here I create a BoolValue and put it into the workspace
happy.Value = true -- here I set it to true 

-- let us say you want to turn it into a string when a player joins the game


game.Players.PlayerAdded:Connect(function()

    if happy.Value then -- check to see if it is true

        print(tostring(happy.Value))

    else -- if the value is false then run code in here

        -- code

    end
end)

Hope that this helped. Have a great day scripting! If you have any questions about the code just comment and I will try to answer them.

Ad
Log in to vote
0
Answered by 6 years ago
bool = true
UIS = game:GetService("UserInputService")
while wait() do
    if UIS:IsKeyDown(Enum.KeyCode.Tab) then
        local str = tostring(bool)
        print(str)
    end
end

I have no clue where athletics101 pulled "else or elseif" out of his hat.

Answer this question