local S=whitelist:CheckWhitelist(game.Players.LocalPlayer.Name)if S==false then rs.Whitelist:Destroy()script.Parent.Toggle:Destroy()script.Parent.Panel:Destroy()script.Parent.Logs:Destroy()script:Destroy()return end function fixcanvas()local S=script.Parent.Panel.PlayerList:GetChildren()local w=#S-1 print(w)script.Parent.Panel.PlayerList.CanvasSize=UDim2.new(0,0,0,w*35)end for S,w in pairs(game.Players:GetPlayers())do local J=script.Username:Clone()J.Name=w.Name J.Text=w.Name J.Parent=script.Parent.Panel.PlayerList fixcanvas()J.MouseButton1Click:Connect(function()if game.Players:FindFirstChild(J.Name)then chosenplr=game.Players:FindFirstChild(J.Name)end end)end game.Players.PlayerAdded:Connect(function(S)local w=script.Username:Clone()w.Name=S.Name w.Text=S.Name w.Parent=script.Parent.Panel.PlayerList fixcanvas()w.MouseButton1Click:Connect(function()if game.Players:FindFirstChild(w.Name)then chosenplr=game.Players:FindFirstChild(w.Name)end end)end)game.Players.PlayerRemoving:Connect(function(S)local w=script.Parent.Panel.PlayerList:FindFirstChild(S.Name)if w then w:Destroy()end fixcanvas()end)for S,w in pairs(script.Parent.Panel.Buttons:GetChildren())do w.MouseButton1Click:Connect(function()local S=nil if w:FindFirstChildOfClass("\084\101\120\116\066\111\120")then S=(w:FindFirstChildOfClass("\084\101\120\116\066\111\120")).Text end print(S)remote:FireServer(w.Name,chosenplr,S)end)end script.Parent.Toggle.MouseButton1Click:Connect(function()script.Parent.Panel.Visible=not script.Parent.Panel.Visible script.Parent.Logs.Visible=not script.Parent.Logs.Visible end)
-- Player List
local iswhitelisted = whitelist:CheckWhitelist(game.Players.LocalPlayer.Name)
if iswhitelisted == false then
	rs.Whitelist:Destroy()
	script.Parent.Toggle:Destroy()
	script.Parent.Panel:Destroy()
	script.Parent.Logs:Destroy()
	script:Destroy()
	return
end

function fixcanvas()
	local amount = script.Parent.Panel.PlayerList:GetChildren()
	local fixedamount = #amount - 1
	print(fixedamount)
	script.Parent.Panel.PlayerList.CanvasSize = UDim2.new(0, 0, 0, fixedamount * 35)
end

for i, v in pairs(game.Players:GetPlayers()) do
	local username = script.Username:Clone()
	username.Name = v.Name
	username.Text = v.Name
	username.Parent = script.Parent.Panel.PlayerList
	fixcanvas()
	username.MouseButton1Click:Connect(function()
		if game.Players:FindFirstChild(username.Name) then
			chosenplr = game.Players:FindFirstChild(username.Name)
		end
	end)
end
game.Players.PlayerAdded:Connect(function(plr)
	local username = script.Username:Clone()
	username.Name = plr.Name
	username.Text = plr.Name
	username.Parent = script.Parent.Panel.PlayerList
	fixcanvas()
	username.MouseButton1Click:Connect(function()
		if game.Players:FindFirstChild(username.Name) then
			chosenplr = game.Players:FindFirstChild(username.Name)
		end
	end)
end)
game.Players.PlayerRemoving:Connect(function(plr)
	local name = script.Parent.Panel.PlayerList:FindFirstChild(plr.Name)
	if name then
		name:Destroy()
	end
	fixcanvas()
end)

for i, buttons in pairs(script.Parent.Panel.Buttons:GetChildren()) do
	buttons.MouseButton1Click:Connect(function()
		local arg2 = nil
		if buttons:FindFirstChildOfClass("TextBox") then
			arg2 = buttons:FindFirstChildOfClass("TextBox").Text
		end
		print(arg2)
		remote:FireServer(buttons.Name, chosenplr, arg2)
	end)
end
script.Parent.Toggle.MouseButton1Click:Connect(function()
	script.Parent.Panel.Visible = not script.Parent.Panel.Visible
	script.Parent.Logs.Visible = not script.Parent.Logs.Visible
end)
