How to connect with MouseButton1Click in this LocalScript?

Hi! Im chila.
A friend shared me a script, when you type “on” or “ssj” in the chat, you become a super Saiyajin.
What I want to do is to connect this script to a ButtonGui, so when the user click it, becomes ssj.
Its a local script in StarterPack.
How to connect to MouseButton1Click?
Here is a part of my code and a screenshot of my Properties:

jun.Chatted:connect(function(Msg) --This is the part where I need to connect with MouseButton1Click
 local msg = Msg:lower()
 if string.sub(msg, 1, 7) == "on" then
 wait(0.1)
  ssj()
 end
 if string.sub(msg, 1, 13) == "ssj" then
 wait(0.1)
  ssj()
 end
 if string.sub(msg, 1, 6) == "!" then
 wait(0.1)
  ssj()
 end
 if string.sub(msg, 1, 10) == "calm" then
 wait(0.1)
  nossj()
 end
 if string.sub(msg, 1, 3) == "off" then
 wait(0.1)
  nossj()
 end
end)

game.Players.LocalPlayer.PlayerGui.SSJGui.TextButton.MouseButton1Click:Connect(function()
   ssj() --or whatever function you want
end

Is there anything wrong I made?

SSJGui is inside StarterGui, and the script is a LocalScript, right?

try this

game.Players.LocalPlayer.PlayerGui:WaitForChild("SSJGui").TextButton.MouseButton1Click:Connect(function()
   ssj() --or whatever function you want
end

OK!, I´ll try :slight_smile: .

Thx!!! Now this is working :smiley:

robloxapp-20200811-0915127.wmv (3.6 MB)