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

I'm trying to acsess 'Buy_Gui' but it says it's not a valid member even though it is??

It's inside of a folder called 'Shop' (and it has been loaded in aswell) local script:

local Shop_Button = script.Parent
local Player = game.Players.LocalPlayer
local Player_Gui = Player:WaitForChild('PlayerGui')
local Cam = workspace.CurrentCamera
local Shop_Cam = workspace:WaitForChild('Shop').Cams.Cam
local Input = game:GetService("UserInputService")
local Set_Tool = game.ReplicatedStorage:WaitForChild('RemoteEvents').Shop:WaitForChild('Set_Tool')
----
Shop_Button.Activated:Connect(function()
	local Fade_Gui = Instance.new('ScreenGui',Player_Gui)
	Fade_Gui.Name = 'Fade_Gui'
	local Frame = Instance.new('Frame',Fade_Gui)
	Frame.Position = UDim2.new(0.46, 0,0.42, 0)
	Frame.Size = UDim2.new(0, 100,0, 100)
	Frame.BackgroundTransparency = 1
	Frame.Size = UDim2.new(0, 1918,0, 1076)
	Frame.Position = UDim2.new(0, 0,0, 0)
	Frame.BackgroundColor3 = Color3.fromRGB(255, 201, 138)
	for i = 1,35 do
		Frame.BackgroundTransparency = Frame.BackgroundTransparency -0.05
		wait(0.01)
	end
		Cam.CameraType = Enum.CameraType.Scriptable
	repeat wait() until Cam.CameraType == Enum.CameraType.Scriptable
	Cam.CFrame = Shop_Cam.CFrame
	wait(0.5)
	for i = 1,35 do
		Frame.BackgroundTransparency = Frame.BackgroundTransparency +0.05
		wait(0.01)
	end
	Fade_Gui:Destroy()
	local Current = "Stick"
	Set_Tool:FireServer(Current)
	----
	local Buy_Gui = Instance.new('ScreenGui',Player_Gui)
	Buy_Gui.Name = 'Buy_Gui'
	Buy_Gui.Parent = Player_Gui.Shop
	local Buy_Button = Instance.new('ImageButton',Buy_Gui)
	Buy_Button.Name = 'Buy_Button'
	Buy_Button.BackgroundTransparency = 1
	Buy_Button.Position = UDim2.new(0, 257,1, 253)
	Buy_Button.Image = "rbxassetid://3881950533"
	if Input.KeyboardEnabled == true then
		Buy_Button.Position = UDim2.new(0, 542,1, 524)
		Buy_Button.Size = UDim2.new(0, 167,0, 93)
		Buy_Button:TweenPosition(UDim2.new(0, 534,0, 503),"Out","Quad",1)
		
	elseif Input.TouchEnabled == true then
		Buy_Button.Size = UDim2.new(0, 152,0, 85)
		Buy_Button:TweenPosition(UDim2.new(0, 257,0, 253),"Out","Quad",1)
	end
	Buy_Button.Activated:Connect(function() --(FROM HERE)
		local Buy_Stick_Remote = game.ReplicatedStorage:WaitForChild("RemoteEvents").Shop.Buy_Stick
		----
		Buy_Stick_Remote:FireServer() --Remote
	end)
end)

Server Script:

game.ReplicatedStorage:WaitForChild('RemoteEvents').Shop.Buy_Stick.OnServerEvent:Connect(function(player,Current)
	print("Server Request accepted.")
	--Variables--
local PlayerGui = player:WaitForChild('PlayerGui')
local Buy_Button = PlayerGui.Shop.Buy_Gui --Cant' acsess
local Current_Tool = player:WaitForChild('Backpack').Current_Tool
----
end)

Output: Buy_Gui is not a valid member of Folder

1 comment

0

maybe try :WaitForChild("Buy_Gui")

1 answer

Pretty sure server can't see PlayerGui's guis.

1 comment

0

It woked on othe gui's

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