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

Everything works fine in this script. But it does not clone to the players GUI?

So what I am trying to do is, if a admin speaks and says ":givescoreboard (name)" then it would see if that name is valid. But for some reason it does not clone the GUI to the person. Why is that?

local admins = {"dogovpain","RandamuHaise","Player1","6trxshankles9","RoberttOriginal"}
local scoreboardValues = game.Workspace.ScoreboardValues

game.Players.PlayerAdded:Connect(function(plr)
	plr.Chatted:Connect(function(msg)
		if msg:sub(1, 16) == ":givescoreboard " then
	    for i = 1,#admins do
		if plr.Name == admins[i] then
		local addPlayer = msg:sub(17, msg:len())	
		print(addPlayer)
		if game.Players:FindFirstChild(addPlayer) then
			print("Player has been found")
			table.insert(admins, addPlayer)
			for i,v in pairs(game.Players:GetPlayers()) do
				if v.Name == admins[i] then
					if v.PlayerGui:FindFirstChild("ManualGui") then
					v.PlayerGui:FindFirstChild("ManualGUI"):Destroy() 
					wait()
					local manual = script.ManualGUI:Clone()
					manual.Parent = v.PlayerGui
				end
				end
				end
		else 
			print("Player has not been found")
			    end
	  		 end
		  end
	   end
	end)
end)

game.Players.PlayerAdded:Connect(function(player)
	local playerGui = player.PlayerGui
	for i = 1,#admins do
		if player.Name == admins[i] then
			local manualGui = script:WaitForChild("ManualGUI")
			local cloneGuiToPlayer = manualGui:Clone()
			cloneGuiToPlayer.Parent = playerGui
			if playerGui:FindFirstChild("ManualGUI") then return end
		end
	end
end)

4 comments

0

That is because the server cannot see PlayerGui. PlayerGui is only visible to the client. You will need to use remote events. Also a tip/suggestion. Use the admins' user ID instead of their name as if they change their name they will no longer be admins in the game.

0

Also you can clone things from a place to the player's PlayerGui. Even tho the server can't see the instances inside the player's PlayerGui, it can see the folder however so that means that you can put Guis there.

0

uhhhh

0

if i fire the event where do i clone the maual gui cause i cant get it from serverscriptservice lol.

1 answer

server

event:FireClient(player)

client

event.OnClientEvent:Connect(function()
	frame.Visible = true
end)

2 comments

0

but the gui doesnt clone to the player

0

so? this is teaching him the setup

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