Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why can't I set the top bar transparency?

Asked by 3 years ago

Here's my local script which is located in Starter Player Scripts:

game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui'):SetTopbarTransparency(0)

2 answers

Log in to vote
0
Answered by
sleazel 1287 Moderation Voter
3 years ago

You are using too many functions in one line. As a rule of a thumb, use only one function per line (however you may sometimes get away with two). To fix, split your code into few lines:

local Player = game:GetService('Players').LocalPlayer
local PlayerGui = Player:WaitForChild('PlayerGui')

PlayerGui:SetTopbarTransparency(0)

Now I am not 100% sure that changing Top Bar transparency is still supported, since the introduction of new transparent bar.

Ad
Log in to vote
0
Answered by
jetape 9
3 years ago
Edited 3 years ago

If you move the localscript into ReplicatedFirst use this script.

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

I just tried it out and it does still work. While your script is correct, it is still better to divide it up. The only problem you had was it was in the wrong spot.

Answer this question