Hey! I’m trying to make a clickable button in surfaceGui but the click event doesn’t work. Anyone knows any alternative way to do this?
local PetsToDefeat = workspace.Pets_To_Defeat
local SFGUI = script.DropChance -- SurfaceGui
for _, Pet in ipairs(PetsToDefeat:GetChildren()) do
if Pet:IsA("Model") then
local MAIN = Pet.MAIN
local ClonedSF = SFGUI:Clone()
local Button = ClonedSF.HealthGUI.Drop
Button.MouseButton1Click:Connect(function()
warn("Clicked")
end)
ClonedSF.Parent = MAIN
ClonedSF.Adornee = MAIN
end
end
Warn doesn’t disable the whole script, only error does. Not quite sure why warn is used here though.
They are trying to make a TextButton inside a SurfaceGui activate so it can output a warning. I don’t think a MouseButton1Click works for a surface GUI, and I’m not sure about activated.