Using or in a returned string statement

I’m trying to print a returned string statement that is a stringvalue, however it seems to print You're either Char1 or Char2! even when my stringvalue is nil
image

function GameEngine.GetType(Player: Player?)
	if Player then
		if game:GetService("ServerStorage"):FindFirstChild(Player.Name.. "'s Data") then
			return game:GetService("ServerStorage"):FindFirstChild(Player.Name.. "'s Data"):FindFirstChild("CharacterType").Value
		end
	end
end
---
local engine = require(game:GetService("ServerScriptService"):FindFirstChild("Modules"):FindFirstChild("__HANDLER"))
script.Parent.ProximityPrompt.TriggerEnded:Connect(function(__PLAYER)
	if engine.GetType(__PLAYER) == "Char1" or "Char2" then
		print("You're either Char1 or Char2!")
	end
end)

image

1 Like

Common problem, but English doesn’t always translate exactly into Lua. You need to re-write it like so:

if engine.GetType(__PLAYER) == "Char1" or engine.GetType(__PLAYER) == "Char2" then

Absolutely correct, just want to add that same principle applies with the and keyword!

2 Likes

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