Help with Topbar script

Hello, I tried making a custom topbar but with several tries from different videos and my own experience it never worked for some reason. This is the code

local TOPBAR_COLOR = Color3.fromRGB(53, 53, 53)
local TOPBAR_TRANSPARENCY = 0

local playerGui = game:GetService(“Player”).LocalPlayer:WaitForChild(“PlayerGui”)

playerGui:SetTopbarTransparency(1)

local screenGui = Instance.new(“ScreenGui”)
local frame = Instance.new(“Frame”)

screenGui.IgnoreGuiInset = true

frame.Size = UDim2.new(1, 0, 0, 36)

frame.BackgroundColor3 = TOPBAR_COLOR
frame.BackgroundTransparency = TOPBAR_TRANSPARENCY
frame.BorderSizePixel = 0

frame.Parent = screenGui
screenGui.Parent = playerGui

Can anyone help me fix this?
(Sorry IDK how to put the code in a box.)

How is it not working? Screenshot of your topbar, please!! :slight_smile:

Note:
game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui'):SetTopbarTransparency(1) in local script under “StarterPlayer.StarterPlayerScripts”. Should work.

Look at PlayerGui | Documentation - Roblox Creator Hub for more information! :slight_smile:

Is this a Local or a Server Script?

I don’t know much about code. But I think it is a Local script because I inserted a LocalScript into the StarterGui.

1 Like

Is it possible that u just copied the script from the hub?

The code does work. It’s localscript and I tested it out in StarterGui section. It creates a topbar black-gray as default is transparent gray. I hope this helps. :herb:

Thx the link you sent helped a lot and I fixed the problem!

Maybe it’s a copy error, but for me it copies quotation marks that don’t work. Try using those ‘’ instead.

Please mark the solution, so no more people reply to this and other players can find the solution for a similar problem faster.

Im kinda new… How do I do that?

Press it.

Oh I already did that on AlertShamrock’s post?

1 Like

I know this post has already been resolved, but something to note: you should try reviewing your own code first before posting a thread. If you skim your code for a bit, you’ll realise that the “Player” service does not exist, it’s “Players”. This would’ve thrown an error in your console.

Always make sure that you apply basic debugging strategies and try searching for what you need before posting threads to this category, as often the issues you may find are due to your own oversights, lack of testing or unreviewed code.

1 Like

Sorry I tried fixing it but I am new to scripting and didn’t see that at all. Thx tough!