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)