script.Parent.MouseButton1Click:Connect(function()
local pg = game.Players.LocalPlayer.PlayerGui
local SG = Instance.new("ScreenGui",pg)
local FRM = Instance.new("Frame",SG)
end)
Hierarchy:
What I want to happen:
Have the button in the SurfaceGui do something when it is clicked.
A LocalScript doesn’t run when it’s a descendant of the Workspace. To fix this, you can parent the SurfaceGui to the StarterGui and set the Adornee property to the part which should display the SurfaceGui.
This is what I did and I tried over a 50 times, I even tired to keep a seperate local script to the gui buttons, but they are not clickable, please help
local gui = game.ReplicatedStorage:WaitForChild("OrderTrainGui")
game.ReplicatedStorage.OrderTrainEvent.OnClientEvent:Connect(function(screenpart,guipart)
screenpart:Destroy()
local clone = gui:Clone()
local gui1 = clone:FindFirstChild("1")
local gui2 = clone:FindFirstChild("2")
clone.Parent = script.Parent
clone.Adornee = guipart
gui1.Visible = true
guipart.SurfaceGui.MainFrame:FindFirstChild("StartingFrame").Visible = false
end)