Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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?

1 comment

0

tostring(bool)

2 answers

✓ Accepted answer
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.

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.