I am trying to make a morph inventory gui. But there is one problem, buttons in scrolling frame won't work.
Here is the code :
for i, v in pairs(script.Parent:GetChildren()) do
v.MouseButton1Click:Connect(function()
print("clicked")
end)
end
Once i click the button, it doesn't print "clicked"
the local script is a child of the scrolling frame. I have a spin system that gives players a character. After the spin, it will be directed to the inventory (scrolling frame).
Here is a snip of the code :
local function addChartoFrame(character)
local clone = template:Clone()
clone.Name = character.Name
clone.name.Text = character.Name
clone.Parent = frame
local newChar = character:Clone()
newChar.Parent = clone.ViewportFrame
local cam = Instance.new("Camera")
cam.CFrame = newChar.Head.CFrame * CFrame.Angles(0, math.rad(180), 0) * CFrame.new(0,0,2.5)
cam.Parent = clone.ViewportFrame
clone.ViewportFrame.CurrentCamera = cam
end
The template in "template:Clone()" is a text button in the replicated storage

3 comments
Thx for the reply! I will try that.
I tried it but sadly, it didn't work :(
I fixed it! I added a childadded function before the for i,v . Thx for the help!