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

how to fix this repeat loop not repeating until the TextTransparency = 0?

--//Varibles\\--
local Plr = game.Players.LocalPlayer
local repStorage = game:GetService("ReplicatedStorage")
local RemoteFolder = repStorage:WaitForChild("RemoteEvents")
local UI = Plr:WaitForChild("PlayerGui")
local Gui = UI:WaitForChild("PlrUI")

local function TextRemote()
	while true do
		Gui.Title.TextTransparency = Gui.Title.TextTransparency - 0.1
		Gui.Title.Title.TextTransparency = Gui.Title.Title.TextTransparency - 0.1
		repeat wait(1) until Gui.Title.TextTransparency == 0 
	end
end


RemoteFolder.TextRemote.OnClientEvent:Connect(TextRemote)



1 comment

0

What are you trying to do? Make the text fade out? Make the text pulse transparent/untransparent?

1 answer

Howdy!

You're not correctly using the repeat, you have it so that only the wait will repeat until it is completely transparent. Try what I have below.

--//Varibles\\--
local Plr = game.Players.LocalPlayer
local repStorage = game:GetService("ReplicatedStorage")
local RemoteFolder = repStorage:WaitForChild("RemoteEvents")
local UI = Plr:WaitForChild("PlayerGui")
local Gui = UI:WaitForChild("PlrUI")

local function TextRemote()
	repeat
		Gui.Title.TextTransparency = Gui.Title.TextTransparency - 0.1
		Gui.Title.Title.TextTransparency = Gui.Title.Title.TextTransparency - 0.1
		wait(1)
	until Gui.Title.TextTransparency == 0 
end


RemoteFolder.TextRemote.OnClientEvent:Connect(TextRemote)

If this helped you out, consider accepting this answer for those sweet, sweet reputation points. If not, comment below and I (or someone else) will help you out.

Be sure to check out the Roblox API Documentation as well for additional reference.

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