Gui not becoming visible

  1. What do you want to achieve? Keep it simple and clear!
    Gui that appears after a few things happen
  2. What is the issue? Include screenshots / videos if possible!
    After the “things” happen the command to make the gui visible does not work.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    classic trouble shooting

this is a script, not a local script btw.

local Seat =  script.Parent 
local Screen = game.Workspace.PcScreen
local Light = game.Workspace["On/OffLight"]
local Part = game.Workspace.Part

Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
	if Seat.Occupant ~= nil then
		local Char = Seat.Occupant.Parent
		wait(.5)
		Char["HumanoidRootPart"].Anchored = true
		wait(.5)
		Light.BrickColor = BrickColor.new("Lime green")
		Seat.On:Play()
		wait(1)
		Seat.PcOn:Play()
		wait(.5)
		Screen.BrickColor = BrickColor.new("Baby blue")
		wait(2.5)
		game.StarterGui.MainPcScreen.MainScreen.Visible = true
	 print("It worked?")
    end
end)

Why does this not work. Please help. (I get no errors) Also, The print I ran at the bottom of the script does print, but the gui does not work, almost like it skipped over it entirely.

2 Likes

Before I send you a possible way to fix the error, I think it is important that you try to solve it from the script properties in roblox studio. If it doesn’t work, try this:

local Seat = script.Parent
local Screen = game.Workspace.PcScreen
local Light = game.Workspace["On/OffLight"]
local Part = game.Workspace.Part

Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
	if Seat.Occupant ~= nil then
		local Char = Seat.Occupant.Parent
		wait(0.5)
		Char.HumanoidRootPart.Anchored = true
		wait(0.5)
		Light.BrickColor = BrickColor.new("Lime green")
		wait(1)
		Seat.On:Play()
		wait(1)
		Seat.PcOn:Play()
		wait(0.5)
		Screen.BrickColor = BrickColor.new("Baby blue")
		wait(2.5)
		game.StarterGui:SetCore("GuiMainScreenOverride", true)
		print("It worked?")
	else
		-- Reset the GUI and other actions here if the seat is unoccupied
	end
end)

It says that SetCore must be set from a local script, and I cant do that because the sounds and parts won’t play/change colors.

you need to get the player’s PlayerGui, not StarterGui

1 Like

Ok, where should I put the script now? I think that should be the last problem.

you can get the player object through player service if you already have the character

local playerService = game:GetService("Players")
local player = playerService:GetPlayerFromCharacter(character)
local playerGui = player:WaitForChild("PlayerGui")

I do not have one for the character.

you do, Seat.Occupant.Parent

Sorry about that roblox wont let me say small sentences for some reason, I fixed the character problem is what I could not say, it was named char not character,

must’ve came from ChatGPT

game.StarterGui:SetCore("GuiMainScreenOverride", true)

is definitely not the solution

yes it’s an example, you need to fill in your own parameters

Yep, roblox says so too, I am getting an error about that right now.

you can get the player by getting the seat’s occupant and doing :GetPlayerFromCharacter()

So now my problem is that faulty code.

And I do not know how to fix that.

Just got deeper into the rabbit whole lol, but this is the line that does not work:

game.PlayerGui:SetCore(“GuiMainScreenOverride”, true)

local playerService = game:GetService("Players")
Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
	if Seat.Occupant ~= nil then
		local Char = Seat.Occupant.Parent
		wait(.5)
		Char["HumanoidRootPart"].Anchored = true
		wait(.5)
		Light.BrickColor = BrickColor.new("Lime green")
		Seat.On:Play()
		wait(1)
		Seat.PcOn:Play()
		wait(.5)
		Screen.BrickColor = BrickColor.new("Baby blue")
		wait(2.5)
		local player = playerService:GetPlayerFromCharacter(Char)
		local playerGui = player:WaitForChild("PlayerGui")
		playerGui.MainPcScreen.MainScreen.Visible = true
		print("It worked?")
	end
end)

does that not work?

2 Likes

YES!!! 0msh this is the second time you have saved me lol thx bro.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.