Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why doesn't the text transparency of my textbox change back to 0 after tween to 1?

I made a remote event which fully functions as it's meant to but every time it happens It doesn't change the text transparency back to 0 how it should do. Here is my script:

local RS = game:GetService("ReplicatedStorage")
local eventsFolder = RS:WaitForChild("RemoteEvents")
local xpEvent = eventsFolder:WaitForChild("XpNotify")

local notifier = script.Parent

local TweenService = game:GetService("TweenService")

--//Tweening Information
local tInfo = TweenInfo.new(1)
local goal = {}
goal.TextTransparency = 1
local tween = TweenService:Create(notifier, tInfo, goal)
--//Script
xpEvent.OnClientEvent:Connect(function(xpAmount)
	print(xpAmount.."xp gained by ".. game.Players.LocalPlayer.Name) --//Prints
	notifier.Text = tostring(xpAmount)
	notifier:TweenPosition(UDim2.new(1, 0,-0.829, 0), Enum.EasingDirection.In, Enum.EasingStyle.Quad, 0.5)
	wait(1)
	tween:Play()
	notifier.Position = UDim2.new(0.25, 0,-0.829, 0)
	repeat
	notifier.TextTransparency = 0 --//Fsr doesn't change it back.
	until notifier.TextTransparency
	print("XP transition DONE!!") --//Prints
end)

Thank you for your time and I hope you have an answer to this question. Any help is appreciated.

1 comment

0

I'm not the best at scripting I'm new here, but try using breakpoints to figure out the line that it stops at

2 answers

✓ Accepted answer

Keep in mind, Tweens do not yield the thread until they are done. This means that if you want to wait for the tween to complete, you have to manually add a wait. Since your tween runs for 1 second, you can fix this with a simple

tween:Play()
wait(1)

If this answer was helpful, please don't forget to mark as solution, thx c;

Keep in mind, Tweens do not yield the thread until they are done. This means that if you want to wait for the tween to complete, you have to manually add a wait. Since your tween runs for 1 second, you can fix this with a simple

tween:Play()
wait(1)

If this answer was helpful, please don't forget to mark as solution, thx c;

This discussion is preserved as it was. New answers, comments, and votes are closed.