Hello i have problem with added text value bc when i start the game and do first click then text label text is not changed value but text that i seted and if i do second click everything is perfect
Script:
Preformatted text`local Lstats = game.Players.LocalPlayer:WaitForChild("leaderstats")
local WinsText = script.Parent.Wins.TextLabel
local RebirthsText = script.Parent.Rebirths.TextLabel
local StrenghText = script.Parent.Strengh.TextLabel
local Strengh = Lstats.Strengh
local Wins = Lstats.Wins
local Rebirths = Lstats.Rebirths
local PopUpText = script.Parent.PopUp2.TextLabel
local Players = game:GetService("Players")
local d = Strengh.Value
if PopUpText.Text == "label" then
wait(.2)
PopUpText.Text = "+"..Strengh.Value - d
end
local function ChangePopupValue(RSanim)
while wait() do
if d ~= Strengh.Value then
PopUpText.Text = "+"..Strengh.Value - d
d = Strengh.Value
end
end
end
local PopUp2 = script.Parent.PopUp2
local function AnimationStrengh(AStrengh)
local newUi = PopUp2:Clone()
newUi.ImageLabel.ImageTransparency = 0
newUi.TextLabel.TextTransparency = 0
newUi.TextLabel.UIStroke.Transparency = 0
newUi.Visible = true
newUi.Parent =script.Parent
local randomX = math.random(160, 687) / 1000
local randomY = math.random(168 ,656) / 1000
local RandomPosition = UDim2.new(randomX, 0, randomY, 0)
newUi.Position = RandomPosition
local Tween = game:GetService("TweenService")
Tween:Create(newUi, TweenInfo.new(.4, Enum.EasingStyle.Quint, Enum.EasingDirection.In), {
Position = UDim2.new(0.268, 0, 0.157, 0)
}):Play()
Tween:Create(newUi.ImageLabel, TweenInfo.new(.5, Enum.EasingStyle.Quint, Enum.EasingDirection.In), {
ImageTransparency = 1
}):Play()
Tween:Create(newUi.TextLabel, TweenInfo.new(.5, Enum.EasingStyle.Quint, Enum.EasingDirection.In), {
TextTransparency = 1
}):Play()
Tween:Create(newUi.TextLabel.UIStroke, TweenInfo.new(.5, Enum.EasingStyle.Quint, Enum.EasingDirection.In), {
Transparency = 1
}):Play()
task.wait(.5)
newUi:Destroy()
end
local function ValueChanged(newValue)
StrenghText.Text = tostring(Strengh.Value)
WinsText.Text = tostring(Wins.Value)
RebirthsText.Text = tostring(Rebirths.Value)
end
ValueChanged(Strengh.Value)
ValueChanged(Wins.Value)
ValueChanged(Rebirths.Value)
Strengh.Changed:Connect(function()
AnimationStrengh()
ValueChanged(newValue)
ChangePopupValue()
end)
Wins.Changed:Connect(function()
ValueChanged(newValue)
end)
Rebirths.Changed:Connect(function()
ValueChanged(newValue)
end)