If, elseif statements not returning proper output

Hello developer forum! Today I was following alvinblox’s tutorial on how to make simulator when I came across the problem of a text button not changing its text under a elseif statement. Not quite sure what the problem is. Thanks for reading!

local replicatedStorage = game:GetService("ReplicatedStorage")
local starterRebirthAmount = 1000

local player = game.Players.LocalPlayer
local mainFrame = script.Parent:WaitForChild("MainFrame")
local rebirthMenu = mainFrame:WaitForChild("RebirthMenu")
local mainButton = script.Parent:WaitForChild("MainButton")
local rebirthButton = rebirthMenu:WaitForChild("RebirthButton")
local drinksToRebirth = rebirthMenu:WaitForChild("StreangthToRebirth")
local rebirths = player:WaitForChild("leaderstats").Rebirths



drinksToRebirth.Text = "You need at least "..math.floor ((starterRebirthAmount + (rebirths.Value) * math.sqrt(10000000))).. " strength to rebirth"

mainButton.MouseButton1Click:Connect(function()
	mainFrame.Visible = not mainFrame.Visible
end)

rebirthButton.MouseButton1Click:Connect(function()
	local result = replicatedStorage.Remotes.Rebirth:InvokeServer()
	print("you got past invoke server")
	if result == true then
		rebirthButton.Text = "Successfully Rebirthed"
		wait(1)
		rebirthButton.Text = "CLICK HERE TO REBIRTH"
	elseif result == "NotEnoughStrength" then
		rebirthButton.Text = "Not Strong Enough"
		wait(1)
		rebirthButton.Text = "CLICK HERE TO REBIRTH"
	
	end
end)

rebirths:GetPropertyChangedSignal("Value"):Connect(function()
	drinksToRebirth.Text = "You need at least"..math.floor((starterRebirthAmount + (rebirths.Value) * math.sqrt(10000000))).."strength to rebirth"
end)

Can you show the code for the server side of the remote function?

Nothing happens in this code? That would mean that result ~= true and result ~= "NotEnoughStrength".

Try changing print("you got past invoke server") to print("Result: ", result), as this will show you what the server returns.

Also, I’d recommend having the result be one type of value, for example only true/false or a string, and not both. If it was only true/false, then your if-else statement would be this:

if result then
	... -- Your code under if result == true
else -- If it isn't true, then it must be false. Therefore we don't need to do elseif result == false
	... -- Code under elseif result == "NotEnoughStrength"
end

Thank you so much for the fix!