So I'm trying to make a game where clicking on a button on a part starts a script.
My script that activates when the button is clicked:
local dup = game.Workspace
local T = .5
local size = Vector3.new (5,5,5)
function REP ()
while true do
local part = Instance.new("Part", dup)
wait()
part.Anchored = false
part.Transparency = T
part.BrickColor = BrickColor.new ('Baby blue')
part.Reflectance = T
part.Material = ("Glass")
part.Size = size
if wait == 0 then
part.Anchored = false
end
end
end
REP()
How do I script a surfaceGui textbutton to run this script when clicked on?

2 comments
Try using Mouse.Button1Down:Connect(function()
If so You can make a script to access Replicated Storage And Then name an event And Make A script to fire the event and the event will launch the script/GUI You need for a menu to pop up