Still have questions? Join our Discord server and get real time help.
0

# 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)

0
"text" as a variable for a ScreenGui is misleading. Use a better variable name. incapaxx 2881 — 4mo

1
Edited 4 months ago

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)