I made a service that creates 3 events for each response. It’s basically just a dialogue service like the ones you see in fisch or grow a garden.
I’m wondering if this is a memory leak or not.
for responseNum, response in dialogueInfo.Responses do
local responseClone = responseTemplate:Clone()
responseClone.Number.Text = "#"..responseNum
responseClone.Button.MainText.Text = response
responseClone.Parent = self.playerOptions.Content
-- These functions are what I'm worrying about
responseClone.Button.MouseEnter:Connect(function()
tweeningModule.Tween(responseClone.Button.MainText, {Position = responseClone.Button.MainText:GetAttribute("TweenPos")}, .1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0, false)
tweeningModule.Tween(responseClone.Button, {ImageTransparency = responseClone.Button:GetAttribute("HoverTransparency")}, .25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0, false)
end)
responseClone.Button.MouseLeave:Connect(function()
tweeningModule.Tween(responseClone.Button.MainText, {Position = responseClone.Button.MainText:GetAttribute("OgPos")}, .1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0, false)
tweeningModule.Tween(responseClone.Button, {ImageTransparency = responseClone.Button:GetAttribute("NormalTransparency")}, .25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0, false)
end)
responseClone.Button.MouseButton1Click:Connect(function()
self.playerOptions:Destroy()
self:playerReply(response, true)
self.response:Fire(dialogueNum, responseNum)
end)
end