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

Text Label Background Transparency not changing?

This script is mostly a test of trying to use most of the script I know. I created a function which would activate a screen (Text Label) when a certain player joins as well as audio

The way I did this was by having a Text Label present on the screen at all times but fully transparent and when the certain player joins it triggers a gradient of decreasing transparency of the Text Label background and the actual text. The screen will then disappear after 3 seconds of being at it's least transparent.

When playing the game though, the transparencies don't seem to change at all. I've tested the same script but using transparencies of parts and they've worked exactly how I wanted but whenever I use this script on the Text Label, it just doesn't work.

...Any Ideas?

-- Ava is the name of the ScreenGui

function screen()
	game.Workspace.TrueLove.Playing = true
	for i = 1,0.39,-0.01 do
		game.StarterGui.Ava.TextLabel.BackgroundTransparency = i
		game.StarterGui.Ava.TextLabel.TextTransparency = i
		game.Workspace.TrueLove.Volume = 1-i
		print(i)
		wait(0.001)
	end  
	wait (3)
	game.StarterGui.Ava.TextLabel.BackgroundTransparency = 1
	game.StarterGui.Ava.TextLabel.TextTransparency = 1
end

game.Players.PlayerAdded:Connect(function(player)
	if player.Name == ("moondragon333")
		then wait(2)
		screen()
	end
end)

1 answer

✓ Accepted answer

A problem you have is that you are accessing game.StarterGui, which is the template folder from which GUIs are cloned. The actual GUIs you want to modify will be cloned into Player.PlayerGui. We can access it like so client-side:

local LocalPlayer = game.Players.LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
local AvaGui = PlayerGui:WaitForChild("AvaGui")

Additionally, your game.Players.PlayerAdded event seems unnecessary. Remember that this event only fires when a player joins, and the script will only run after you have joined. Instead, you can get rid of the event and just check if game.Players.LocalPlayer is the player we want to work with.

3 comments

0

Thank you very much!

0

epic answer avigant. I see this mistake made so often.

0

The game.PlayersAdded is to check if its him, it's not in a localscript

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