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

[Solved] Why does my print code output an error attempt to concatenate string with boolean?

I have a simple script where it should print "clicked (true or false depending on a bool)" but it just returns this: attempt to concatenate string with boolean

Script:

local variables = game.Workspace:WaitForChild("Variables")
local fixedServers = variables:WaitForChild("FixedServers")
local totalServers = variables:WaitForChild("TotalServers")
local smoke = script.Parent.Smoke
local canUse = true

totalServers.Value = totalServers.Value + 1

local function OnClick(player)
	print("clicked " .. canUse)
	canUse = false
	if canUse == true then
		canUse = false
		smoke:Destroy()
		fixedServers = fixedServers + 1
	end
end

	                           
script.Parent.ClickDetector.MouseClick:connect(OnClick)

1 answer

I got it working, i replaced the .. with a ,

If anyone wants the code its here:

local variables = game.Workspace:WaitForChild("Variables")
local fixedServers = variables:WaitForChild("FixedServers")
local totalServers = variables:WaitForChild("TotalServers")
local smoke = script.Parent.Smoke
local canUse = true

totalServers.Value = totalServers.Value + 1

local function OnClick(player)
    print("clicked " .. canUse)
    canUse = false
    if canUse == true then
        canUse = false
        smoke:Destroy()
        fixedServers = fixedServers + 1
    end
end


script.Parent.ClickDetector.MouseClick:connect(OnClick)

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