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

How can I make text fade in via ScreenGui?

I'm trying to make a smooth text fade in on a screengui, but it won't change the transparency.

local part = game.Workspace.handle
local text = game.Players.LocalPlayer.PlayerGui:FindFirstChild("ScreenGui")
function onClicked()
	wait(1)
	for i = 1, 10 do
	text.Frame.TextLabel.TextTransparency = text.Frame.TextLabel.TextTransparency - 0.1
	wait(0.01)
	end
end

part.Button.ClickDetector.MouseClick:Connect(onClicked)

1 comment

0

"text" as a variable for a ScreenGui is misleading. Use a better variable name.

1 answer

✓ Accepted answer

Hi lolkid007! I'm here to help you. You don't can have access to the players folder with the server. So to create that, you do need to use:

LocalScript RemoteEvent

So put a RemoteEvent on ReplicatedStorage. Put a LocalScript on your ScreenGui and now write this.

LocalScript:

local text = game:GetService('Players').LocalPlayer.PlayerGui:WaitForChild("ScreenGui")

function onClicked()
	wait(1)
	for i = 1, 10 do
		text.Frame.TextLabel.TextTransparency = text.Frame.TextLabel.TextTransparency - 0.1
		wait(0.01)
	end
end

game:GetService('ReplicatedStorage').RemoteEvent.OnClientEvent:Connect(onClicked)

And this is now your Script in the workspace.

local part = game:GetService('Workspace').handle

part.Button.ClickDetector.MouseClick:Connect(function(Player)
	game:GetService('ReplicatedStorage').RemoteEvent:FireClient(Player)
end)

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