Problems with freecam whitelist script

Hello, Im trying to make a freecam whitelist ui, but when I try to clone the screengui that cointains the freecam script to the playergui of another player, it says playergui is not a valid member of that player.

Here’s the script im using:

local button = script.Parent
local player = game.Players.LocalPlayer
local buttons = {script.Parent.Parent.Name1, script.Parent.Parent.Name2, script.Parent.Parent.Name3, script.Parent.Parent.Name4, script.Parent.Parent.Name5, }
local isonserver
local freecam = script.Parent.Parent.Freecam
local new

button.MouseButton1Click:Connect(function()
	local plr = game.Players:FindFirstChild(script.Parent.Parent.Box.Text)
	if plr then
		local pla = plr
		print("OK")
		local free = pla.PlayerGui:FindFirstChild("Freecam")
		if not free then
			new = freecam:Clone()
		end
		new.Parent = pla.PlayerGui
		if script.Parent.Parent.Name1.Text == "" then
			script.Parent.Parent.Name1.Text = pla.Name
			script.Parent.Parent.Name1.Value.Value = new
			script.Parent.Parent.Name1.Player.Value = pla
		elseif script.Parent.Parent.Name1.Text ~= "" and script.Parent.Parent.Name2.Text == "" then
			script.Parent.Parent.Name2.Text = pla.Name
			script.Parent.Parent.Name2.Value.Value = new
			script.Parent.Parent.Name2.Player.Value = pla
		elseif script.Parent.Parent.Name2.Text ~= "" and script.Parent.Parent.Name3.Text == "" then
			script.Parent.Parent.Name3.Text = pla.Name
			script.Parent.Parent.Name3.Value.Value = new
			script.Parent.Parent.Name3.Player.Value = pla
		elseif script.Parent.Parent.Name3.Text ~= "" and script.Parent.Parent.Name4.Text == "" then
			script.Parent.Parent.Name4.Text = pla.Name
			script.Parent.Parent.Name4.Value.Value = new
			script.Parent.Parent.Name4.Player.Value = pla
		elseif script.Parent.Parent.Name4.Text ~= "" and script.Parent.Parent.Name5.Text == "" then
			script.Parent.Parent.Name5.Text = pla.Name
			script.Parent.Parent.Name5.Value.Value = new
			script.Parent.Parent.Name5.Player.Value = pla
		else
			print("Im done")
		end
	else
		print("BAD")
	end
end)
1 Like