If player has joined before then disable screengui But It's not Working

Hello There,

I’m trying to make the Screengui disable if the player has joined before and nothing is working.!

This is what I got and nothing is happening

local PlrDisableMainFrame = game.ReplicatedStorage.PlrDisableMainFrame


game.Players.PlayerAdded:Connect(function(Player)
	PlrDisableMainFrame:FireClient()


if Player.ChildRemoved then

Player.PlayerGui.Tutorial.Enabled = false

game.Players.PlayerRemoving:Connect(function(Player)

  end)
 end
end)

If someone can Point out What I’m doing wrong that would helpful :slight_smile:

So i wondering what is the point of this line

Player.ChildRemoved is a Connection Event so i think just removed that line should work fine

local PlrDisableMainFrame = game.ReplicatedStorage.PlrDisableMainFrame


game.Players.PlayerAdded:Connect(function(Player)
	PlrDisableMainFrame:FireClient()

	Player.PlayerGui.Tutorial.Enabled = false

	game.Players.PlayerRemoving:Connect(function(Player)

	end)
end)

Okay I’ll remove that and see what happens.

Nothing Happen sorry. Is there anything else I’m missing?

It look like PlayerAdded won’t fire in solo Play in studio so you have two choice here

  1. Test in the real place (Join via roblox website)

  2. Check the currently exist player then disable it with other function and bind PlayerAdded below (This should work on both studio and real place)
    and i think this should work now

local PlrDisableMainFrame = game.ReplicatedStorage.PlrDisableMainFrame


local function DisableGui(Player)
	PlrDisableMainFrame:FireClient(Player)
	Player.PlayerGui.Tutorial.Enabled = false

	game.Players.PlayerRemoving:Connect(function(Player)

	end)

end

for _, Player in ipairs(game.Players:GetPlayers()) do
	DisableGui(Player)
end

game.Players.PlayerAdded:Connect(function(Player)
	DisableGui(Player)
end)

I used Localscript is the Screengui and Idk if that was the Problem.

welp i thought you using in normal script
and No it won’t be a problem but if the script you show is a LocalScript then use this will be a lot better

local plr = game:GetService("Players").LocalPlayer

plr:WaitForChild("PlayerGui").Tutorial.Enabled = false

Ok I’ll replace that with the other one.

It Removed it When the player Has joined again. Thank you for the Help :slight_smile:

1 Like