How do i parent a button to scrolling frame?

Hello, I have my button and I need to do a Parent every time I press the E, what am I doing wrong?

image

localscript

local player = game.Players.LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local gui = game.ReplicatedStorage.b1

-- We must get the UserInputService before we can use it
local UserInputService = game:GetService("UserInputService")

-- A sample function providing one usage of InputBegan
local function onInputBegan(input, gameProcessed)	
	if input.KeyCode == Enum.KeyCode.E then
		print("The left mouse button has been pressed!")
		local clonedGui = gui:Clone()
		clonedGui.Parent = player.PlayerGui
	end
end

UserInputService.InputBegan:Connect(onInputBegan)

You’re not parenting it to the scrolling frame, but to the PlayerGui. Just add a bigger path to it.

clonedGui.Parent = player.PlayerGui.ScreenGui.Frame.ScrollingFrame
1 Like

Thanks you brother! it works :smiley: