Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

There is no error but the GUI dose not apear on the screen in this script?

Everything works except for the GUI. Also, I am going to fix the script using remote events but I first need to fix this here is the code:

local gui = game.StarterGui.BreethGUI
local UserInputService = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer	
--// Checking for key input

UserInputService.InputBegan:Connect(function(inputObject)
	if inputObject.UserInputType == Enum.UserInputType.MouseButton1 then
		

     local leaderstats = plr:WaitForChild("leaderstats") if leaderstats then
	

     local Breths = leaderstats:FindFirstChild("Breths") if Breths then
     gui.Enabled = true
gui.TextLabel.Visible = true
     Breths.Value = Breths.Value + 1 
end
	end
	end
	end)
    

1 answer

✓ Accepted answer

##Question

There is no error but the GUI does not appear on the screen in this script?

##Answer Line 1 of your code. (local gui = game.StarterGui.BreethGUI) You are setting gui to the gui in StarterGui. Note that you are not changing the clients GUI you are changing the GUI that is replicated to the client. What you should do is index the local player's GUI.

The local client's GUI is in a folder named PlayerGui which is a child of the player's instance. You will want to edit and index the stuff in there

###Example Code

local players = game:GetService("Players")
local client = players.LocalPlayer

local clientGui = client:WaitForChild("PlayerGui")
local gui = clientGui:WaitForChild("BreethGui")

(Hey you should accept this answer if it helped you)

This discussion is preserved as it was. New answers, comments, and votes are closed.