The function Items:ButtonHandler is being called but the issue seems to be the the button:MouseButton1Click isn’t working.
And yes their is a button and when i print (Button) it gets the button the issue is that the button:MouseButton1Click is both not printing the print(“Called”) and is not working or seems to be buggin as i have tried varies troubleshooting methods and do not understand why the button:MouseButton1Click isn’t working.
If any of you can help me out it will be appreciated.
local Items = {}
Items.__index = Items
function Items:new(Boards, HoverBoardGui, H_ViewPortFrame)
local self = setmetatable({}, Items)
--//Instances
self.BoardsFolder = Boards
self.HoverBoardGuiScreen = HoverBoardGui
self.AssetVPR = H_ViewPortFrame
self.SelectButton = self.AssetVPR.SelectButton
for _, v in self.BoardsFolder:GetChildren() do
--//Variables
local SelectFrame = self.HoverBoardGuiScreen.Frame.Select
local InfoFrame = self.HoverBoardGuiScreen.Frame.Info
local ScrollingFrame = SelectFrame.ScrollingFrame
local Camera = Instance.new("Camera", self.AssetVPR.ViewportFrame)
local VprF_C = self.AssetVPR:Clone()
local V_C = v:Clone()
local A_ = 0
--//Constant
VprF_C.Parent = ScrollingFrame
VprF_C.ViewportFrame.CurrentCamera = Camera
V_C.Parent = VprF_C.ViewportFrame
--//Connecting Function
self:CourtineHandler(A_, Camera, V_C)
self:ButtonHandler(self.SelectButton, self.BoardsFolder)
end
return self
end
function Items:CourtineHandler(A_, Camera, V_C)
--//CoroutineWrapFunction
coroutine.wrap(function()
while wait() do
A_ += 1
Camera.CFrame = V_C.ViewPart.CFrame * CFrame.Angles(0, math.rad(A_), 0) * CFrame.new(0, 1.7, V_C.ViewPart.Size.Z * 1) * CFrame.Angles(math.rad(-15), 0, math.rad(-37))
end
end)()
end
function Items:ButtonHandler(Button, Boards)
print(Button)
--//Const
Button.MouseButton1Click:Connect(function()
print("Called")
Items:GiveItem(Boards)
end)
end
function Items:GiveItem(_Boards)
print("Items:GiveItem function called")
--//Const
for _, Board in (_Boards:GetChildren()) do
local BoardClone = Board:Clone()
BoardClone.Parent = Player.Backpack
if BoardClone.Parent ~= Player.Backpack then
print("Player has "..BoardClone.Name.." in his bag")
end
end
end
return Item