My backup detection is not working

i have a function and im trying to make it so if one of the paremters is “” or nil then it wont do anything, otherwise it changes the enum.font, but its trying to change the font even though its detecting nil?

local function Caption(Text, Dur, Color, Rich, Font, SND)
	local Clone = script.Cap:Clone()
	Clone.Parent = script.Parent.Frame
	Clone.Visible = true
	Clone.Text = Text
	Clone.RichText = Rich
	
	if Color ~= "" or nil then -- i havent testes ths one
		Clone.TextColor3 = Color
	end
	
	if Font ~= "" or nil then -- this one still changes the font even if "Font" is nil
		Clone.Font = Font
	end
--The rest is irrelevant

does this wawrafok

local function Caption(Text, Dur, Color, Rich, Font, SND)
	local Clone = script.Cap:Clone()
	Clone.Parent = script.Parent.Frame
	Clone.Visible = true
	Clone.Text = Text
	Clone.RichText = Rich
	
	if Color ~= "" and Color~=nil then -- i havent testes ths one
		Clone.TextColor3 = Color
	end

--The rest is irrelevant

wait I forgot do the same for that with the font too

i set it up for font too, it works thank you

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.