You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want the new cost variable to be able to save so that when the player leaves and rejoins their rebirth cost will still be the same. -
What is the issue? Include screenshots / videos if possible!
The issue is, is that the new cost variable is unable to save but the new multiplier variable is able to. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
No, but I did try getting help from other communities.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local MaxLevel = 25
local OpenrebirthFrame = script.Parent:WaitForChild("RebirthOpen")
local RebirthFrame = script.Parent:WaitForChild("RebirthFrame")
local RebirthButton = RebirthFrame:WaitForChild("Rebirthing")
local leaderstats = player:WaitForChild("leaderstats")
local Rebirths = leaderstats:WaitForChild("Rebirths")
RebirthButton.MouseButton1Up:Connect(function(player)
local Wins = leaderstats:WaitForChild("Wins")
print("Wins.Value:", Wins.Value)
print("MaxLevel:", MaxLevel)
if Wins.Value >= MaxLevel then
local didPlayerRebirth = RebirthFunction:InvokeServer()
didPlayerRebirth = true
print(didPlayerRebirth)
local newMultiplier = Rebirths.Value + 2
RebirthFrame.Multiplier.Text = "Your new multiplier will be "..newMultiplier .. "x"
MaxLevel = MaxLevel * 2
local newCost = MaxLevel + Wins.Value -- Assign value to newCost
RebirthFrame.Cost.Text = "Cost: " .. newCost .. "Wins"
else
RebirthFrame.Cost.Text = "Not enough wins"
wait(3)
local newCost = MaxLevel + Wins.Value
RebirthFrame.Cost.Text = "Cost: " .. newCost .. " Wins"
end
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.