TextBox and ImageButton exist but they are not going visible as if like I didn't type it in script

  1. What do you want to achieve? I want to turn visible on when function fires and ingame value is true

  2. What is the issue? I have no idea the script is not turning them on as if like the lines do not exist, there are no errors and I have checked if it exist in PlayerGui it is there

  3. What solutions have you tried so far? I have tried printing ImageButton name it printed it correctly so the imagbutton not nil but when I have done print(ImaggeButton.Parent) it did not print anything did not even give an error like the same issue Idk why

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidrootpart = character:WaitForChild("HumanoidRootPart")
local currentCamera = workspace.CurrentCamera
local Camera1 = workspace:WaitForChild("Camera1")
local MainMenu = game.SoundService:WaitForChild("Main Menu")
local RunService = game:GetService("RunService")
local Surrender	= player.PlayerGui:WaitForChild("SurrenderGui").TextButton
local TextBox = player.PlayerGui:WaitForChild("RP").TextBox
local ImageButton = player.PlayerGui:WaitForChild("RP").ImageButton

_G.FinishedUniform = false
_G.SelectingColor = false
local HeartBeatConnection

function PlayerInGame(Ingame)
	if Ingame then
		Surrender.Visible = true
		TextBox.Visible = true
		ImageButton.Visible = true
		print(ImageButton.Parent)
		print(ImageButton.Name)
		print("All on")
		currentCamera.CFrame = CFrame.new(humanoidrootpart.Position)
		currentCamera.CameraType = Enum.CameraType.Custom
	end
end

coroutine.resume(coroutine.create(function()
	function HeartBeat()
		if _G.SelectingColor ~= true and game.ReplicatedStorage.InGame.Value == false then
			currentCamera.CFrame = currentCamera.CFrame * CFrame.Angles(0,0.001,0)
		end
		if _G.FinishedUniform and _G.ColorFinished then
			game.Lighting.FogEnd = 5500000
			repeat task.wait() until game.ReplicatedStorage.InGame.Value == true
			PlayerInGame(game.ReplicatedStorage.InGame.Value)
			print(HeartBeatConnection)
			HeartBeatConnection:Disconnect()
		end
	end	
end))

function PlayernotInGame()
	Surrender.Visible = false
	TextBox.Visible = false
	ImageButton.Visible = false
	HeartBeatConnection = RunService.Heartbeat:Connect(HeartBeat)
	currentCamera.CFrame = CFrame.new(Camera1.Position)
	currentCamera.CameraType = Enum.CameraType.Scriptable
end

game.ReplicatedStorage.InGame.Changed:Connect(function(InGame)
	if not InGame then
		MainMenu:Play()
		PlayernotInGame()
	end
end)

if game.ReplicatedStorage.InGame.Value == false then
	print("testing")
	MainMenu:Play()
	PlayernotInGame()
end

Did you put them inside a gui?
ex. ScreenGui, SurfaceGui, BillboardGui

Yeah inside ScreenGui, here is a picture
image

Okay, is the ScreenGui’s Enabled property set to true or the TextBox/ImageButton’s Visible property enabled? Also try checking their position

1 Like

All of them are enabled,

if you check in picture the visible is just not turned on

if I turn it on they will be in the same position
image