Script affects server but not client

The problem is he’s changing the startergui version and not his playergui version.

I only see that happening if the player loads after the script is executed. Maybe I really dont understand this

I looked in that post, but the creator did not set a solution, and I don’t know what part I need to add/edit.

That makes sense, if you change something in the startergui then everyone who joins afterwards would receive that copy, which was updated. The startergui is just a container for all the guis, whenever you join, you get a copy of all the guis in startergui put in your playergui. This is why if you make a change to a gui in startergui, and then someone joins, they would get the changed version.

yes but he should be using PlayerGui instead. I dont think that script would work based on given information. Maybe im wrong. Ill test it right now

This was the post that I thought might help, but you should probably read up on StarterGui on the developer hub.

Yeah that’s the point I’m trying to make. The problem isn’t that he’s doing this in a server script but that he’s changing the starter gui’s version instead of your player gui’s version. Although it’s better to work with ui in local scripts so this should be a local script anyway. Maybe we should continue in dms because this post is getting pretty clogged.

I just get this when activating the script "Attempt to index nil with ‘PlayerGui’ " Also, its fine once we figure it out i can just set the solution for anyone who finds this.

You can’t use game.Players.LocalPlayer on the server so this would have to be a local script if you want to get the player like that. Where is this script?

It is a local script, and its in the workspace. I don’t know if it doesn’t work because the way I am doing it is this: It’s disabled, then i go into studio play mode, then i press server client and then enable it via explorer.

Local scripts have to be descended from the player/ the player’s character to run (for the most part).

Try this out: (This should be a local script inside your screengui)

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

while true do
	PlayerGui.bright.Frame.BackgroundTransparency = PlayerGui.bright.Frame.BackgroundTransparency -0.01
	wait(0.01)
end

Sorry if I’m being confusing.

1 Like

That works great, (and dont worry I am understanding you). However, it works fine if it is enabled before playing, but if i try to enable it during playing (via script and via explorer) it does not seem to work. I’ll set it as a solution since that is what I asked, the disable thing is a different topic sort of.

When you set the enable property you have to set it for the actual playerGui script not the starterGui btw. You can enable/disable by going inside your player

But that just causes a loop, if I can only use PlayerGui in local scripts, and local scripts cant be disabled while in game, how am I supposed to enable the script? I might misspoke, In a nutshell: How can I enable a disabled script that is in StarterGui?

They can be disabled in game since you control your client. You have to go into your playerGui

Yes I know that, but what would I need to type to disable/enable it for a client using a script? For example,

wait(10)
game.StarterGui.bright.fadewhite.Disabled = false

in a regular or local script does not enable it for the client

If you want to disable a script you need to use .Disabed = true
And this will only work in a local script.

If you are doing it correctly, then it might be something else

I was not clear enough, my bad. This is a normal script, it’s in workspace it’s what i have and it does not work. I want the local script in StarterGui to enable for all clients.

wait(10)
game.StarterGui.bright.fadewhite.Disabled = false

does not work.

You can “use” Playergui in both local scripts and server scripts.

This is because when you update a gui in the startergui all the versions in everyone’s playerguis won’t automatically update to the startergui’s version.

wait(10)

for _, Player in pairs(game.Players:GetChildren()) do
    Player.PlayerGui.bright.fadewhite.Disabled = false
end

Try this instead, it loops through everyone’s playerguis and enables “fadewhite”