Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Missing part of my Self Check In script?

It is around --// Prevent Duplicate of Gui

local gui = script.Parent
local mFrame = gui:WaitForChild("mFrame")
local classFrame = mFrame:WaitForChild("classFrame")
local lastFrame = mFrame:WaitForChild("lastFrame")
local startFrame = mFrame:WaitForChild("startFrame")
script:WaitForChild("uid").Value = game:GetService("HttpService"):GenerateGUID()


local plr = game:GetService("Players").LocalPlayer


--// Prevent Duplicate of Gui
for i,v in pairs(plr.PlayerGui:GetChildren()) do
	if v:IsA("ScreenGui") then
		if v:FindFirstChild("scHandler") then
			if v.scHandler.uid.Value ~= script:WaitForChild("uid").Value then
				v:Remove()
			end
		end
	end
end

--// Button Detections
mFrame:WaitForChild("closeBtn").MouseButton1Down:Connect(function()
	gui:Remove()
end)

1 answer

I have found the correct answer It was because the Script inside the Part was missing a part that I have put in now...

Part // Click Detector Script (DO NOT PUT INSIDE THE CLICK DETECTOR)

local part = script.Parent
local click = part:WaitForChild("ClickDetector")

click.MouseClick:Connect(function(plr)
	local gui = game:GetService("ServerStorage"):WaitForChild("scGUI"):Clone()
	gui.Parent = plr.PlayerGui
end)

THIS IS THE LOCALSCRIPT (scHandler) put inside the Screen Gui and add a StringValue called uid into the scHandler...

local gui = script.Parent
local mFrame = gui:WaitForChild("mFrame")
local classFrame = mFrame:WaitForChild("classFrame")
local lastFrame = mFrame:WaitForChild("lastFrame")
local startFrame = mFrame:WaitForChild("startFrame")
script:WaitForChild("uid").Value = game:GetService("HttpService"):GenerateGUID()


local plr = game:GetService("Players").LocalPlayer


--// Prevent Duplicate of Gui
for i,v in pairs(plr.PlayerGui:GetChildren()) do
	if v:IsA("ScreenGui") then
		if v:FindFirstChild("scHandler") then
			if v.scHandler.uid.Value ~= script:WaitForChild("uid").Value then
				v:Remove()
			end
		end
	end
end

--// Button Detections
mFrame:WaitForChild("closeBtn").MouseButton1Down:Connect(function()
	gui:Remove()
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.