I made a rebirth system and it works well but I found an issue with it. The GUI that you press to rebirth is supposed to have its text changed to the required points that the player needs for the next rebirth but it stays the same. How do I fix this?
local replicatedStorage = game:GetService("ReplicatedStorage")
local buttonevent = replicatedStorage:WaitForChild("RebirthEvent")
local debounce = true
local pointsRequired = 500
local function buttonPressed(plr)
local pStats = plr:WaitForChild("leaderstats")
local pGui = plr:WaitForChild("PlayerGui")
local pRebirthButton = pGui:WaitForChild("Rebirth").Frame.TextButton.TextButton_Roundify_12px.RebirthButton
local pPoints = pStats:FindFirstChild("Robux")
local pRebirths = pStats:FindFirstChild("Rebirths")
if debounce and pPoints.Value >= pointsRequired then
debounce = false
pRebirths.Value = pRebirths.Value + 1
pPoints.Value = 0
pointsRequired = pointsRequired * 1.5
pRebirthButton.Text = "Robux Required:" ..tostring(pointsRequired)
else
debounce = false
pRebirthButton.Text = "Robux Required:" ..tostring(pointsRequired)
end
wait(0.5)
debounce = true
end
buttonevent.OnServerEvent:Connect(buttonPressed)
I may be wrong, but doesn’t scripts sometimes don’t work if there’s a number representing a variable? Maybe try renaming the TextButton_Roundify_12px element to something without numbers.
Btw: You don’t need a plug-in to make rounded corners on a GUI, you can add a UICorner element to the button.
Yeah you’re wrong. You can name a variable like this local hello1 = "hello" but not like this local 1hello = "hello". You can’t have a number at the beginning of the name of a variable.
Yep, that’s right.
You can just change the text from the LocalScript where you fired the RemoteEvent. It’s a long process to change a LocalPlayer item/property from a ServerScript.
yeah, I just tried changing the name of the variable and it had the same effect. I think it might have something to do with it being a client-sided change and not server-sided. not too sure though.