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

None of the frames will turn invisible, im pretty sure my script looks fine, why?

local player = game.Players.LocalPlayer
local StarterGui = game.workspace.Player.PlayerGui
function leftClick()
--game.Workspace.Classes.Baguette.Parent = game.StarterPlayer
--game.Baguette.Name = "StarterCharacter"
game.StarterGui.Baguette.Visible = false
game.StarterGui.MainFrame.Visible = false
game.StarterGui.Frame.Visible = false
game.ScrollingFrame.Visible = false
game.StarterGui.SideInfo = false
end
function rightClick()	
print("Right mouse click")
end
script.Parent.MouseButton1Click:Connect(leftClick)
script.Parent.MouseButton2Click:Connect(rightClick)

Not sure if this even is an error   13:18:56.525 Player is not a valid member of Workspace "Workspace"  -  Client  -  LocalScript:2   13:18:56.525 Stack Begin  -  Studio   13:18:56.525 Script 'Players.poop07393cfhi3n2222.PlayerGui.ClassPicker.MainFrame.ScrollingFrame.Baguette.LocalScript', Line 2  -  Studio  -  LocalScript:2   13:18:56.525 Stack End  -  Studio

2 comments

0

What are you exactly wanting to do if you wanna do a block all you have to do i put transparency to a 1

0

StarterGui is a replication container. You need to access the active local user-interface: Player -> PlayerGui

1 answer

✓ Accepted answer

I will try to explain what is going on here, but I will admit you were approaching it all wrong.

-- Okay well your script for one is trying to modify StarterGui to change the players Gui. This won't work as StarterGui is just a storage for the stuff that gets replicated to a player on spawn.
-- In order to edit a players actualy GUI you have to edit his PlayerGui located in the player. Ie, local ScreenGui = game.Players.LocalPlayer.PlayerGui.ScreenGui
-- Secondly, What are you trying to define with playergui? What is workspace.Player? That isn't an actual thing unless you made it yourself. A player is made up of two categories, their player which handles all the scripts, and usually leaderstats and such, and then the players physical character which is stored in workspace and contains the limbs and humanoid of a player. You wont find anything related to GUI's here.
-- Thirdly, your script can be made simpler and I will show you how


--When creating Gui's you are supposed to place them inside of a ScreenGui. Lets go ahead and define that screengui
local player = game.Players.LocalPlayer
local ScreenGui = player.PlayerGui.ScreenGui

local function CloseGui()
	ScreenGui.Baguette.Visible = false
	ScreenGui.MainFrame.Visible = false
	ScreenGui.Frame.Visible = false
	ScreenGui.ScrollingFrame.Visible = false
	ScreenGui.SideInfo = false
end
local function rightClick()   
	print("Right mouse click")
end

script.Parent.MouseButton1Click:Connect(CloseGui)
script.Parent.MouseButton2Click:Connect(rightClick)




-- Now lets point out a few issues with your code so you can try to avoid them next time
local player = game.Players.LocalPlayer
local StarterGui = game.workspace.Player.PlayerGui -- This doesn't exist, unless you made it yourself. To get a players physical character model, you can get that with player.Character. Gui's are also not stored here, they are inside player.PlayerGui
function leftClick()
	--game.Workspace.Classes.Baguette.Parent = game.StarterPlayer     
	--game.Baguette.Name = "StarterCharacter" 
	game.StarterGui.Baguette.Visible = false -- You are modifying what is given to a player on spawn, instead of what they have already.
	game.StarterGui.MainFrame.Visible = false
	game.StarterGui.Frame.Visible = false
	game.ScrollingFrame.Visible = false -- game.ScrollingFrame doesn't exist, I assume you meant game.StarterGui.ScrollingFrame, but again wrong guis to edit.
	game.StarterGui.SideInfo = false
end
function rightClick()   
	print("Right mouse click")
end
script.Parent.MouseButton1Click:Connect(leftClick)
script.Parent.MouseButton2Click:Connect(rightClick)

2 comments

0

aha, thanks, I was trying to get to PlayerGui by defining StarterGui as player gui, and since your player appears in workspace i assumed that the PlayerGui is in it

0

The player that appears in workspace is just the character model itself. Everything else is stored under game.Players

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