I know it has something to do with cloning to to the StarterGui, but I don't know how. Any help would be appreciated. Here is the start of the script.
function show() end script.Parent.ClickDetector.MouseClick:connect(show)
function show() plr:WaitForChild("PlayerGui").ScreenGui.Frame.Visible = true end script.Parent.ClickDetector.MouseClick:connect(function(plr) show() end)
You where correct with the function, So to continue on that we need to clone the gui into the players Playergui
function FindClosestPlayer() dist = 20 pl = "" for i,v in pairs(game.Players:GetPlayers()) do if v.Character ~= nil then if (v.Character.Torso.Position - script.Parent.Position).magnitude < dist then dist = (v.Character.Torso.Position - script.Parent.Position).magnitude pl = v.Name end end end if pl ~= "" then return pl end end function onClicked() for i,v in pairs(script:GetChildren()) do if v:IsA("ScreenGui") then cl = v:clone() pl = FindClosestPlayer() if game.Players:FindFirstChild(pl) ~= nil then if game.Players:FindFirstChild(pl).PlayerGui:FindFirstChild(v.Name) == nil then cl.Parent = game.Players:FindFirstChild(pl).PlayerGui game.Players:FindFirstChild(pl).Character.Humanoid.WalkSpeed = 0 end end end end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
Gui must be in the script, and script in the part.
Hope this helps
Just do this:
function Clicked() game.StarterGui.ScreenGui.Frame.Visible = true end script.Parent.MouseButton1Down:connect(Clicked)
-- This is just a basic way of trying to make a Gui show up. If you want to get advanced you would use a loop.